各位,在下遇到一个有关宏的问题解决不了,故前来请教各路高手。问题如下:
先上程序:
%let _pgm=tcon020;
%macro report(data=);
%if
&data in (&_pgm._1_1,&_pgm._1_3) %then %do;
%put "the table outputed is table1";
%end;
%else if
&data in (&_pgm._1_2,&_pgm._1_4) %then %do;
%put "the table outputed is table2";
%end;
%mend report;
%report(data=&_pgm._1_1)
程序报错,提示为: ERROR: 需要的操作符在以下表达式中没有找到: &data in (&_pgm._1_1,&_pgm._1_3)
ERROR: 宏 REPORT 将终止执行。
本人将程序改成了
%let _pgm=tcon020;
%macro report(data=);
%if
&data=&_pgm._1_1 or &data=&_pgm._1_3 %then %do;
%put "the table outputed is table1";
%end;
%else if
&data=&_pgm._1_2 or &data=&_pgm._1_4 %then %do;
%put "the table outputed is table2";
%end;
%mend report;
%report(data=&_pgm._1_1)
程序正常运行。
所以请教高手,难道在宏中,”IN'这个 statement不用能?我试过在”IF‘宏环境中能用,难道只有在“%IF"宏环境中无法使用?
请教为什么及除了改用”=“号外的好的解决办法,谢谢各位!