Hi All ,
i have an SAS emailer, it should not sent any mails if there is NO Data | Error- any where in a project.
i have an 4 Process flows in SAS EG and using Query Builders .
Thanks,
Siva
have used another idea for skipping this "Stop SAS EG project if error is encountered"
Answer:
If my data set does not have any observations then it should not sent a mail alert with the message of
"No production happened on 15th MAR 2019"
By referring below links of sas.support
Not send email if error exist
Do not send email if no data
proc sql send result count in macro
%let day=%sysfunc(putn(%eval(%sysfunc(today())-1),date9.));
%put &day;
%MACRO record_check;
%local count cnt;
proc sql;
select count(*) into :cnt from WORK.EMPData;
quit;
%if &cnt > 0 %then
%do;
filename outbox email /*"&Email."*/
to=('siva.kumar@SAShealth.com')
cc=('kumar.siva@SAShealth.com')
type='text/html'
subject='No production happened on &day'
from="sas.test@SAShealth.com";
run;
ods html body=outbox style=minimal rs=none;
data new;
set WORK.EMPData;
run;
title HEIGHT=0.5cm color=black JUSTIFY=CENTER BOLD "Test Report";
title;
ods;
%end;
%MEND record_check;
%record_check;
I never used it, but you can add conditions to every step in process flow, the build-in help has a chapter about "conditional processing".
have used another idea for skipping this "Stop SAS EG project if error is encountered"
Answer:
If my data set does not have any observations then it should not sent a mail alert with the message of
"No production happened on 15th MAR 2019"
By referring below links of sas.support
Not send email if error exist
Do not send email if no data
proc sql send result count in macro
%let day=%sysfunc(putn(%eval(%sysfunc(today())-1),date9.));
%put &day;
%MACRO record_check;
%local count cnt;
proc sql;
select count(*) into :cnt from WORK.EMPData;
quit;
%if &cnt > 0 %then
%do;
filename outbox email /*"&Email."*/
to=('siva.kumar@SAShealth.com')
cc=('kumar.siva@SAShealth.com')
type='text/html'
subject='No production happened on &day'
from="sas.test@SAShealth.com";
run;
ods html body=outbox style=minimal rs=none;
data new;
set WORK.EMPData;
run;
title HEIGHT=0.5cm color=black JUSTIFY=CENTER BOLD "Test Report";
title;
ods;
%end;
%MEND record_check;
%record_check;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.