BookmarkSubscribeRSS Feed
dkanand86
Calcite | Level 5

Hi All,

I urgently require a generic sas macro code for sending emails through SAS.

Please provide code and possible solutions to this problem.

Thanks and Regards,

4 REPLIES 4
dkanand86
Calcite | Level 5

Hi,

When i run this above macro code, it gives following error:

 

ERROR: Email: The connection was refused

Regards

FriedEgg
SAS Employee

You need to configure SAS with a valid email system so that it can actually work:

Example of Sending E-Mail Using SMTP

The following examples show how you can send e-mail by using SMTP from a DATA step and how you can send your ODS HTML output as HTML and not as an attachment to your e-mail.

To use SMTP you need an SMTP e-mail server that you can access.

To configure SAS to use SMTP, add these system options to your configuration file:

  • -emailsys SMTP
  • -emailhost your.email.server.com
  • -emailport 25.

Ask your system administrator for the location of your.email.server.com. Port 25 is the most common port.

The following code uses the FILENAME statement and a DATA step to send e-mail:

filename mymail email from="yourid@email.com" to="id1@.emailaddr.com" "id2@emailaddr.com") subject="Put Subject Here" content_type="text/html"; data _null_; file mymail; put 'hello world'; run; quit;

http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#sassession.htm#usi...

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 6847 views
  • 0 likes
  • 3 in conversation