Hi All,
How can i send a conditional email with different subject messages .Can you please help me out as im trying to execute my job in batch mode and trying to send emails based on success/unsuceesful of job ! i tried below but it is going to else statement even if the if statement is true.
FILENAME TEMP EMAIL TO=(
"person@yahoocom"
)
;
DATA _NULL_;
set my_log1;
IF &count1.=0 then do;
FILE TEMP
subject="PBDV report Successfull for &run_date." ;
PUT 'PLEASE VIEW THE REPORT IN THE REPORTING PORTAL ' ;
PUT ;
today = put(date(),worddate18.);
PUT ' ' today;
PUT ;
end;
else
do;
file temp
subject="PBDV report not Successfull for &run_date.";
PUT "PBDV REPORT FAILED FOR &run_date." ;
PUT ;
Put ' This e-mail is an automated notification!';
PUT ;
PUT 'DO NOT REPLY TO THIS MESSAGE ';
Put '=============================================';
Put ' Please contact:';
Put ' .person.@yahoo.com
' ;
Put ' if you have any questions or concerns.' ;
Put '=============================================';
Put ;
end;
RUN;
even IF statement is true , it is going to else staement and sending subject of the email "as job not successfull ".
If you're testing with the code you've posted then I don't see how this could happen.
Are you sure your macro variable contains a 0 when you believe the condition should be TRUE?
Use options symbolgen; to see in the Log to what your macro var resolves;
For test purposes populate the macro variable manually right before the data step
%let count1=0;
yes my count1 is resolving to 0, i have double checked but not sure why it is going to else part!
post your log (as attachment)
I have used Email directives from SAS and it worked, i just replaced current subject with the new one's.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.