If statement 如何在SAS中调整数据步骤

If statement 如何在SAS中调整数据步骤,if-statement,sas,dataset,execute,If Statement,Sas,Dataset,Execute,我在一个大的调用execute中,只有当标志变量是0而不是1时,我才需要执行数据步骤。 也就是说,如果flag=1,则数据步骤开始,否则不开始。 因此,我应该在宏外部和数据步骤外部使用IF。 我该怎么修理 提前感谢您需要使用宏语言以及if和then等的宏版本。试试这个: %let flag = ; *or method/logic such as :into or other to set macro value to 1 or 0; %macro pre_run_check();

我在一个大的
调用execute
中,只有当标志变量是
0
而不是
1
时,我才需要执行数据步骤。 也就是说,如果
flag=1
,则数据步骤开始,否则不开始。 因此,我应该在
外部和数据步骤外部使用
IF
。 我该怎么修理


提前感谢

您需要使用宏语言以及if和then等的宏版本。试试这个:

%let flag = ; 

*or method/logic such as :into or other to set macro value to 1 or 0;

%macro pre_run_check();
    %if &flag = 1 %then %do;

    *CODE HERE;

    %end;
%mend;

%pre_run_check();

2016年7月28日:捷克葡萄干编辑

请举例说明您使用的代码。