【发布时间】:2021-04-22 09:57:53
【问题描述】:
我有这段代码
%macro test(full);
%if &full. = 0 %then %do;
data temp;
set sashelp.air;
run;
%end;
%if &full. = 1 %then %do;
data temp;
set sashelp.air;
where air > 140;
run;
%end;
%mend;
%test(1);
或在开放代码中
%let full = 1;
%if &full. = 0 %then %do;
data temp;
set sashelp.air;
run;
%end;
%if &full. = 1 %then %do;
data temp;
set sashelp.air;
where air > 140;
run;
%end;
有没有办法得到类似的东西(这段代码不起作用):
%macro test(full);
data temp;
set sashelp.air;
%if &full. = 0 %then %do; %sysfunc(call execute('where air>140;')); %end;
run;
%mend;
%test(1);
当然也可以是开放代码。我想让条件只在数据步内起作用,避免整个数据步重复。
【问题讨论】: