Wednesday, October 18, 2006

Emailing SAS Output

Every need to email your SAS output? You can save the contents of the log or output window then use Outlook to email the file, or you can write SAS code that will email the file for you.

A DATA step that sends electronic mail has the following components:
· a FILENAME statement with the EMAIL device-type keyword
· options specified on the FILE statement indicating the e-mail recipients, subject, and any attached files
· PUT statements that contain the body of the message

This example uses PROC OPTIONS, which lists the current settings of SAS system options and displays the results in the SAS log. This code:
1. Executes PROC OPTIONS
2. Redirects the log to a file (options.log)
3. Sends an email to the specified addressees with options.log as an attachment.

proc printto log='options.log';
proc options;
proc printo log=log;
filename outbox email;
data _null_;
file outbox
Subject="Test Email"
Attach = "options.log";

put 'Emailing SAS output with a filename statement.';

Click here to learn more about sending email with SAS.


Post a Comment

<< Home