BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sivastat08
Pyrite | Level 9

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
sivastat08
Pyrite | Level 9

 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;

 

 

 

View solution in original post

2 REPLIES 2
andreas_lds
Jade | Level 19

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".

sivastat08
Pyrite | Level 9

 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;

 

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1709 views
  • 1 like
  • 2 in conversation