0

为什么这个非常简单的宏程序:

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

1 回答 1

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);
于 2014-09-30T15:27:32.687 回答