BookmarkSubscribeRSS Feed
JohnA_Brown
Calcite | Level 5

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

5 REPLIES 5
JohnA_Brown
Calcite | Level 5

there are seveal entries int the log, is there anything in particular you want me to send?

jakarman
Barite | Level 11

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?

 

---->-- ja karman --<-----
JohnA_Brown
Calcite | Level 5

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.

jakarman
Barite | Level 11

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.

---->-- ja karman --<-----

sas-innovate-2024.png

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.

 

Register now!

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
  • 5 replies
  • 757 views
  • 0 likes
  • 3 in conversation