为什么这个非常简单的宏程序:
%macro test1(N=,NN=);
proc iml;
start fun_test(x) global(&NN,&N);
x=&NN+&N;
finish fun_test;
call fun_test(x);
print x;
run;
quit;
%mend test1;
%test1(N=10,NN=22);
给出错误? :
22
ERROR 22-322: Expecting a name.
ERROR 200-322: The symbol is not recognized and will be ignored.
答案 0 :(得分:1)
START语句中的GLOBAL子句需要有效SAS标识符的名称。当您调用宏时,程序将解析为
start fun_test(x) global(22,11);
...
这是无效的语法。
也许这就是你要找的东西?
%macro test1(N=,NN=);
proc iml;
start fun_test(x) global(N,NN);
x=N + NN;
finish fun_test;
N = &N; NN = &NN;
call fun_test(x);
print x;
run;
quit;
%mend test1;
%test1(N=10,NN=22);