EZ Study

Actuarial Biology Chemistry Economics Calculators Confucius Engineer

SAS programming Skills
SAS Tutorial: How to send Email in SAS part-I

Question: How can we send email in SAS, attach files etc? .

Answer: We can use FILENAME statement and _null_ data statement to send email in SAS.

Example: Here is an SAS code example to send email in SAS, it's been tested on SAS 9.1.3 and SAS 9.2:

        /******* Complete email setup in filename statement ********/

        filename mymail email to=("accountname@gmail.com","account@aol.com")

        subject="SAS Email funtion testing"
        /**********         _null_ data statement           ************/
        data _null_;
        file mymail;
        put 'Hello! Awesome!';
        put 'This is a SAS email function Testing';

Something to Note:

In case if there was a window jumping out, mentioning you need to input some email settings, like: incoming mail server(POP3,IMAP/HTTP) or outgoing mail server(SMTP), it's because you haven't set up the outlook email account, the tutorial part-II will show you how to set up the email account settings.

Here is the link to tutorial part-II:
        How to set up email account before sending email in SAS?

It's a good idea to include this in the end of your sas programming, especially if you are running a big project, it's hard to determine when to complete the task. With the email-sending from SAS, you can easily get a "task-complete" message when you check your email, and you don't have to log into the remote SAS server to check the SAS program.

If you have any questions, you are welcome to send us a message, and we will explain with more details.

Related links:

Continue to: How to send email in SAS part-II   SAS tutorial home
Back to: Useful Resources for SAS professionals   Statistics tutorial home