【问题标题】:How to conditioning a data step in SAS如何在 SAS 中调节数据步骤
【发布时间】:2016-11-17 05:27:00
【问题描述】:

我在一个大的call execute 中,只有当标志变量是0 而不是1 时,我才必须执行数据步骤。 也就是说,如果flag=1 则开始数据步骤,否则不开始。 所以我应该在macro 之外和数据步骤之外使用IF。 我该如何解决?

提前致谢

【问题讨论】:

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

标签: if-statement sas dataset execute


【解决方案1】:

您需要使用宏语言,以及 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 日:已编辑捷克葡萄干

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多