SAS包含动态路径

时间:2018-11-08 17:24:12

标签: macros sas execute

我已经尝试构建一个小宏,它应该在循环中运行其他SAS程序。 表Control_files有两个字段,其中是正确的sas程序路径的其他部分。

%LET PATH_TO = '%include "T:\XXX\YYY\ZZZ\';
%LET PATH_end = '.sas"';
data _null_;
set CONTROL_FILES;
call execute ('%runlimitsquery('||&PATH_TO||SCHEMA_NAME||'\'||PROCES_NAME||&PATH_end||');');
run;

我尝试使用runlimitsquery,因为我发现了那个提示。 当我运行代码时,日志返回:

NOTE: CALL EXECUTE generated line.
NOTE: Line generated by the CALL EXECUTE routine.
1         + %runlimitsquery(%include "T:\XXX\YYY\ZZZ\XXX_TECHNICAL_AAAAA\001_AAAAA.sas");
            _
            180
WARNING: Apparent invocation of macro RUNLIMITSQUERY not resolved.

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

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

好,我有问题的答案... 下面的代码有效:

%LET PATH_TO = '%include "T:\XXX\YYY\ZZZ\';
%LET PATH_end = '.sas"';
data _null_;
set CONTROL_FILES;
call execute ('('||&PATH_TO.||SCHEMA_NAME||'\'||PROCES_NAME||&PATH_end.||';');
run;