Math
Math

Reputation: 1294

SAS simple Macro - Error

Why this very easy Macro programme :

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

Gives the error? :

      22
ERROR 22-322: Expecting a name.
ERROR 200-322: The symbol is not recognized and will be ignored.

Upvotes: 0

Views: 352

Answers (1)

Rick
Rick

Reputation: 1210

The GLOBAL clause on the START statement expects the names of valid SAS identifiers. When you call the macro, the program resolves to

   start fun_test(x) global(22,11);
    ...

which is not valid syntax.

Maybe this is what you are looking for?

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

Upvotes: 1

Related Questions