Send results inside SAS to your email
2006-07-02    Zhiyong Zhang   
Print from: Zhiyong Zhang \'s Psychometric Website

The idea here is to first save your output into a file and then send the file as an attachment into your email. We illustrate this process using an example.

1. This example first creates a data set called sendmail and then prints the content of the data set into the output.

/*Create an example*/
data sendmail;
input test;

proc print data=sendmail;

2. The output is then saved into a file called test.out using the codes like

/*Save the output and the log into files*/
DM OUTPUT 'FILE "c:\send\test.OUT"';
DM LOG    'FILE "c:\send\test.LOG"';

3. Finally, we send this output file as attachment to your email using the codes like

/*Send the output to your email*/
data _null_;
call system('c:\send\mailcmd "mail.xxxx.xxxx"
"" "" "Subject: SAS results" "Contents: SAS results" "" "c:\send\test.OUT"');

In this step, we used a dos program called mailcmd which can be downloaded by clicking this link In my example, I put this dos file in the folder "c:\send".

Run step 1 to 3, you will receive an email with the file test.out as an attachment.

Editor: johnny