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*/
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*/
call system('c:\send\mailcmd "mail.xxxx.xxxx" "email@example.com" "firstname.lastname@example.org" "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 http://www.sms4mail.com/download/mailcmd.zip. 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.