Desktop productivity for business analysts and programmers

Need urgent help with EG

Occasional Contributor
Posts: 19

Need urgent help with EG


Need some urgent help in EG.

I wish to send automated email reports (with excel attachment) to our top 200 customers - report will have data such as their last purchase date, amount, etc. I have a dataset that consists of data related to these top 200 customers. I want to make a program that loops through every record (one record for every customer) in the dataset, creates a list report in EG, and then pastes that list report in Excel and send it through email (outlook) to the customer. This entire process should be automated in EG. I know Base SAS language but do not know Macro programming. Can anyone please help me?

It will be great if someone can help me with the code.



Posts: 1,471

Re: Need urgent help with EG


Suggest you search for SAS papers about emailing results. Easiest probably to search for mail merge, email, etc.

Could be tough to set it up without macro prorgamming (at least for me).

With the macro language, you could write a macro which produces the report for one customer (probably with ods tagsets.excelxp  if you want an excel-like attachment, or ods html if you want to the table in the body of the email) and then emails it.  Then you could loop through your list of 200 customers calling the macro for each.


Super User
Posts: 4,011

Re: Need urgent help with EG

Also please note that any SAS programs involving email communication run from EG will run on your SAS server.

If your SAS server is "local" then SAS on your EG PC will send the email through your local email client. If you have a remote SAS server then email will be sent via the email software on that server.

Posts: 9,423

Re: Need urgent help with EG

Hi, just my .02 on the subject. You also have to remember that email options fall into 2 categories - -the options like TO and FROM and SUBJECT and possibly the attachment that will change with the mail for every customer. But then there are also system level options related to emailing from SAS that have to be established at start-up time. You would need to work with your SAS administrator and/or your e-mail administrator to be sure that 1) you can send automated emails and 2) you know the right type of email to use and 3) to make sure that the proper system options are set for your SAS session (whether local or server based).


Trusted Advisor
Posts: 3,215

Re: Need urgent help with EG

The best entries with you will find using "tilanus" eg:

Mailing using Outlook with Eguide is a nogo. SAS and Outlook are not connected that way.  Microsoft did a lot of work to stop Spammers.
You can use mail with SAS but you are needing to bypass the spammer protection. What you are needing is a mail configuration within SAS that is open enough.
As a pitty SAS is far behind market evolvments. You are needing possibly to run the latest SAS-version (ssl password).

SAS(R) 9.4 System Options: Reference, Second Edition ( EMAILHOST= System Option).

The server / mail traffic must not be blocked to reach those mailservers by a firewall.

The older mail configurations are relying on "bulk-mail" that is an open relay defined to a mail-server. You have to negotiate for that to get those kind of things open.
Within bigger organizations sometimes this is done as part of a service.  

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 4 replies
  • 5 in conversation