oxygenmz 发表于 2010-1-22 14:43 
sashelp.prdsale totalobs 明明大于10, 为什么RC最后的结果是 LOW...? 谢谢了~
options symbolgen;
%let rc=Begin;
%macro test;
data out;
set sashelp.prdsale nobs=totalobs;
if totalobs > 10 then do;
%let rc=high;
end;
else do;
%let rc=low;
end;
run;
%mend;
%let rc= Before Execution;
%test
%put answer: &rc; |
Others already pointed out where the problem is.
Here is a simpler version of you codes.
%macro nobs(dsn=);
data _null_;
if 0 then set &dsn nobs=nobs; ***note nobs is available at compiling time. Not needed to open it and read it;
if nobs >10 then call symputx('rc','High');
else call symputx('rc','Low');
run;
%put rc=&rc;
%mend;
%nobs(dsn=sashelp.class)
data t1;
x=1;
run;
%nobs(dsn=t1)