在 SAS 中使用 ODS 发送警报

Sending an ALERT using ODS in SAS

我尝试仅在宏变量值不为 0 时才发送警报,并且始终发送另一个警报,两者都在同一个脚本中。

我只想在变量值不为 0 时发送此消息。

filename myfile1 email To=&ToAddress
subject="ALERT for &tday." TYPE="text/html";
ODS LISTING CLOSE;
ODS HTML BODY=myfile1 style=BarrettsBlue;
OPTIONS NOCENTER LINESIZE=256;

Proc print data=Counts_6days noobs label;
title "monitoring by Score Date";
run;
ODS html close;
ods listing;

我想一直发这个。

filename myfile email To=&ToAddress
subject="monitoring for &tday." CONTENT_TYPE="text/html";

ODS LISTING CLOSE;
ODS HTML BODY=myfile style=BarrettsBlue;
OPTIONS NOCENTER LINESIZE=256;

Proc print data=COUNTS noobs label;
title "monitoring by Score Date";
run;

ODS HTML CLOSE;
ODS LISTING;

在 SAS 中,条件宏语句需要包含在宏中。例如:

%macro example(arg);
    %if &arg. ~= 0 %then %do;
        /* Your conditional code here */
    %end;
%mend example;
%let var = 0;
%example(&var.)

此代码创建了一个 macro called %example which expects one parameter. The macro is called with %example(), at which point it evaluates the code inside the macro. The %if %then %do; %end; 块,允许您根据条件的计算结果是真还是假来选择某些代码是否 运行。

在您的情况下,您可以将第一个块包装在与此类似的宏中,同时将第二个块留在外面。