从自动调用库

时间:2017-03-21 22:56:15

标签: macros sas

尝试从AUTOCALL库执行存储的宏时遇到错误。

我已使用以下内容在文件夹中存储了一个宏:

libname myMacr 'C:\My Macros';
options mstored sasmstore = myMacr;

%macro HelloWorld() / store;
  %put Hello, world!;
%mend;

当我在运行此文件夹后查看该文件夹时,我看到已按预期创建了目录sasmacr.sas7bcat

接下来,我已将C:\My Macros添加到我的AUTOCALL库列表中。通过运行

proc options option=config;
run;

找到我的配置文件。按照Creating an autocall macro library on a PC中给出的说明,我将C:\My Macros添加到AUTOCALL列表中。关闭并重新打开SAS,我可以确认我的文件夹已添加到AUTOCALL列表中:

%put %sysfunc(pathname(sasautos));

确实,C:\My Macros出现在列表中。此外,我可以确认SAS看到编译的宏。当我发出:

proc catalog;
  contents catalog=sasautos.sasmacr;
quit;

我得到了输出

                              Contents of Catalog SASAUTOS.SASMACR

 #    Name          Type     Level            Create Date          Modified Date    Description

 1    HELLOWORLD    MACRO       14    03/21/2017 18:44:28    03/21/2017 18:44:28

但是,当我发出%HelloWorld();时,我收到错误:

1    %HelloWorld();
     -
     180
WARNING: Apparent invocation of macro HELLOWORLD not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.

我做错了什么?是否有一些选项我可以忽略哪些必须打开?为了从C:\My Macros文件夹运行存储的宏,我需要做什么?

1 个答案:

答案 0 :(得分:0)

放线

-initstmt "options mstored sasmstore=sasautos;"

在配置文件中。这将在SAS初始化时在引号内发出命令。

MSTORED

SASMSTORE=