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;

 

 

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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