我正在使用 oscmd 命令从 sas 运行一些操作系统操作,但希望通过在 oscmd 命令中传递变量来使其通用。我正在使用以下代码:
%global name =skstar; filename oscmd pipe "python test.py --inputvar=&name.";
变量'name'的值不在命令中替换。
编辑:上面的部分现在正在工作,它只是一个引用错误。但想知道中止oscmd cli命令的方法,如果传递的参数值错误
我正在使用 oscmd 命令从 sas 运行一些操作系统操作,但希望通过在 oscmd 命令中传递变量来使其通用。我正在使用以下代码:
%global name =skstar; filename oscmd pipe "python test.py --inputvar=&name.";
变量'name'的值不在命令中替换。
编辑:上面的部分现在正在工作,它只是一个引用错误。但想知道中止oscmd cli命令的方法,如果传递的参数值错误
也许你的数据步是错误的,但你没有写在那里。它工作正常:
%let name=test words;
filename oscmd pipe "echo &name.";
data _null_;
infile oscmd;
input;
put _infile_;
run;
/*log:
NOTE: The infile OSCMD is:
Unnamed Pipe Access Device,
PROCESS=echo test words,RECFM=V,LRECL=32767
test words
NOTE: 1 record was read from the infile OSCMD.
The minimum record length was 10.
The maximum record length was 10.
NOTE: DATA statement used (Total process time):
real time 0.18 seconds
cpu time 0.03 seconds
*/