Macros SAS简单宏-错误

Macros SAS简单宏-错误,macros,sas,sas-iml,Macros,Sas,Sas Iml,为什么这是一个非常简单的宏观计划: %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. E

为什么这是一个非常简单的宏观计划:

%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.

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);

实际上,它给出了正确的答案,但这个错误不应该更像:
%macrotest1(N,NN);proc-iml;启动趣味测试(x)全局(&NN,&N);x=&NN+&N;完成趣味测试;调用fun_测试(x);打印x;跑退出;%修复测试1;%试验1(10,22)谢谢@jj72uk,但我仍然有相同的错误,我们还可以添加:选项symbolgen;在调用宏之前