我收到一些 SAS v9.1.3 代码的分辨率错误。
这是我想存储在 .txt 文件(称为 problem2.txt)中并使用 %INC 带入 SAS 的一些代码
%macro email020;
%if &email = 1 %then %do;
%put THIS RESOLVED AT 1;
%end;
%else %if &email = 2 %then %do;
%put THIS RESOVLED AT 2;
%end;
%put _user_;
%mend email020;
%email020;
然后这是主要代码:
filename problem2 'C:\Documents and Settings\Mark\My Documents\problem2.txt';
%macro report1;
%let email = 1;
%inc problem2;
%mend report1;
%macro report2 (inc);
%let email = 2;
%inc problem2;
%mend report2;
data test;
run = 'YES';
run;
data _null_;
set test;
call execute("%report1");
call execute("%report2");
run;
日志显示:
NOTE: CALL EXECUTE generated line.
1 + %inc problem2;
MLOGIC(EMAIL020): Beginning execution.
WARNING: Apparent symbolic reference EMAIL not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &email = 1
ERROR: The macro EMAIL020 will stop executing.
MLOGIC(EMAIL020): Ending execution.
所以问题是为什么 CALL EXECUTE 生成 %inc problem2 而不是 %report1,导致 SAS 错过分配,我该怎么办?