09-03-2014 10:22 AM
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 ("firstname.lastname@example.org")
subject = "this is a test email";
/* Body of email */
put ' ';
put 'process completed';
put 'The file is located in the following folder';
put 'folder location';
put ' ';
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?
09-03-2014 10:33 AM
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?
09-03-2014 10:41 AM
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.
09-03-2014 11:53 AM
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.