仅当满足某些条件时才从SAS发送电子邮件
我希望SAS发送电子邮件,但前提是全局宏变量&warning等于1 这可能吗?我正在尝试以下方法,但不起作用。当警告=0时,它仍然发送电子邮件仅当满足某些条件时才从SAS发送电子邮件,sas,enterprise-guide,proc-report,Sas,Enterprise Guide,Proc Report,我希望SAS发送电子邮件,但前提是全局宏变量&warning等于1 这可能吗?我正在尝试以下方法,但不起作用。当警告=0时,它仍然发送电子邮件 filename outbox email to=('me@myemail.com') subject='Warning Report' from='you@myemail.com' attach='/report.html'; DA
filename outbox email
to=('me@myemail.com')
subject='Warning Report'
from='you@myemail.com'
attach='/report.html';
DATA _null_;
file outbox;
Put "Hello,"//
"Warning report attached."//
"Regards,"/
"Chris";
if &warning. =1
run;
试试这个:
%let warning=1;
%macro send();
%if &warning. =1 %then %do;
filename outbox email
to=('myemail@mail.com')
subject='Warning Report'
from='you@myemail.com'
;
DATA _null_;
file outbox;
Put "Hello,"//
"Warning report attached."//
"Regards,"/
"Chris";
run;
%end;
%mend;
%send;
试试这个:
%let warning=1;
%macro send();
%if &warning. =1 %then %do;
filename outbox email
to=('myemail@mail.com')
subject='Warning Report'
from='you@myemail.com'
;
DATA _null_;
file outbox;
Put "Hello,"//
"Warning report attached."//
"Regards,"/
"Chris";
run;
%end;
%mend;
%send;
我认为这是因为您不使用then,即使在there,我认为会有语法问题,SAS将无法完成该代码块或返回错误。。。。 你可以把它放在一个宏中,它就会工作 试试这样的
%macro email(condition=);
%if &condition.=1 %then %do;
filename outbox email
to=('me@myemail.com')
subject='Warning Report'
from='you@myemail.com'
attach='/report.html';
DATA _null_;
file outbox;
Put "Hello,";
Put "Warning report attached.";
Put "Regards,";
Put "Chris";
run;
%end;
%mend;
%email(condition=&warning.);
我认为这是因为您不使用then,即使在there,我认为会有语法问题,SAS将无法完成该代码块或返回错误。。。。 你可以把它放在一个宏中,它就会工作 试试这样的
%macro email(condition=);
%if &condition.=1 %then %do;
filename outbox email
to=('me@myemail.com')
subject='Warning Report'
from='you@myemail.com'
attach='/report.html';
DATA _null_;
file outbox;
Put "Hello,";
Put "Warning report attached.";
Put "Regards,";
Put "Chris";
run;
%end;
%mend;
%email(condition=&warning.);
您应该能够使用电子邮件指令中止邮件 !!放弃!停止当前消息。您可以使用此指令 停止SAS软件在结束时自动发送消息 数据步骤
您应该能够使用电子邮件指令中止邮件 !!放弃!停止当前消息。您可以使用此指令 停止SAS软件在结束时自动发送消息 数据步骤
不能基于步骤中的if表达式有条件地运行步骤 您可以继续打开代码步骤,并有条件地将
RUN
语句修改为RUN CANCEL
,明智地使用%sysfunc(ifc
。“好处”是您不需要将逻辑嵌入单独的宏中
%let warning = 0;
data _null_;
put "NOTE: macro symbol 'warning' is &warning";
run %sysfunc(ifc(&warning,CANCEL,));
%let warning = 1;
data _null_;
%* never executed because step is cancelled;
put "NOTE: macro symbol 'warning' is &warning";
run %sysfunc(ifc(&warning,CANCEL,));
不能基于步骤中的if表达式有条件地运行步骤 您可以继续打开代码步骤,并有条件地将
RUN
语句修改为RUN CANCEL
,明智地使用%sysfunc(ifc
。“好处”是您不需要将逻辑嵌入单独的宏中
%let warning = 0;
data _null_;
put "NOTE: macro symbol 'warning' is &warning";
run %sysfunc(ifc(&warning,CANCEL,));
%let warning = 1;
data _null_;
%* never executed because step is cancelled;
put "NOTE: macro symbol 'warning' is &warning";
run %sysfunc(ifc(&warning,CANCEL,));
hehehe你赢了我(hehehe你赢了我(hehehe你赢了我)他不在宏他不在宏