How can I get an email data step to send a notification when the sas program runs from a scheduler?

Reply
New Contributor
Posts: 3

How can I get an email data step to send a notification when the sas program runs from a scheduler?

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

Regular Contributor
Posts: 233

Re: How can I get an email data step to send a notification when the sas program runs from a scheduler?

Can you share the log?

New Contributor
Posts: 3

Re: How can I get an email data step to send a notification when the sas program runs from a scheduler?

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

Valued Guide
Posts: 3,208

Re: How can I get an email data step to send a notification when the sas program runs from a scheduler?

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 --<-----
New Contributor
Posts: 3

Re: How can I get an email data step to send a notification when the sas program runs from a scheduler?

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.

Valued Guide
Posts: 3,208

Re: How can I get an email data step to send a notification when the sas program runs from a scheduler?

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 --<-----
Ask a Question
Discussion stats
  • 5 replies
  • 266 views
  • 0 likes
  • 3 in conversation