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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.