How can I get an email data step to send a notification when the SAS program runs from a scheduler?
I have a data step that sends an email notification to myself when the SAS process is complete.
filename sendmail email ("toaddress@email.com")
subject = "this is a test email";
data _null_;
file sendmail;
/* Body of email */
put ' ';
put 'process completed';
put 'The file is located in the following folder';
put 'folder location';
put ' ';
run;
When I run the process manually when SAS is open, the email notification gets sent. The SAS process, however, is scheduled automatically through windows task scheduler, and although the processs completely runs, i do not get an email notification.
Any ideas on how to solve?
Thank you,
John
Can you share the log?
there are seveal entries int the log, is there anything in particular you want me to send?
lsf and most other professional schedulers are supporting an email notify as part of their settings.
No need to program sas code for that.
Using the windows scheduler on your desktop is not the best way fort scheduling. As you noticed the mail settings are default connected to outlook.
You must change a lot of settings to an external mailprovider to get around that so it will run as a batch-job.
A batch-job better background-job is a way of running processes without any keyboard / screen interaction.
Did you run your process manually as a batch-job?
I did not run manually as a batch job that i know if, I am still a fairly new SAS programmer, so not sure how to set this up.
For running in batch see: http://support.sas.com/documentation/cdl/en/hostwin/67279/HTML/default/viewer.htm#n0yfzk61sv9f2wn1o2...
The crux is using a windows script (.bat .cmd), similar as a scheduler does.
The log should be save so you can see that after it has been run.
For email-usage to an email provider see: http://support.sas.com/documentation/cdl/en/lesysoptsref/67465/HTML/default/viewer.htm#p1v9dr6zep9p9...
There are several of those. There must be en emailproivider Exchange server (not your localhost) to serve that.
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!
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.
Ready to level-up your skills? Choose your own adventure.