The SAS Output Delivery System and reporting techniques

How To Attach a webpage on my email?

Frequent Contributor
Posts: 78

How To Attach a webpage on my email?

Hi All,

I have just created a HTML page call Test.Htm which contains four line graphs.

I am using SAS to automate an email with the html page attached to it and send it to my manager monthly. So that when he opens up the email, it will just show the content of the html (showing all the graphs). This is my script so far...

SUBJECT = "Monthly Sales Report & Graphs";
FILE Finnote;
PUT '???????????? ';
PUT '????????????? ';

I undestand that this will only automate the email however, it does not attach the webpage on the email.

Hoping someone can help out ! Smiley Sad

Posts: 9,371

Re: How To Attach a webpage on my email?

If you search using the string
ODS HTML email
you will come up with a lot of hits. This is just one of them:

For what you're doing (HTML page with graphs), you will probably want to use the second method and use ATTACH=
for the HTML page (and remember that if you have created the type of HTML page with <IMG> tags you'll also need to attach the image files).

I do recommend that you search on, as there are some configuration options that you may need to have your SAS administrator set so you can use the EMAIL method.

Super Contributor
Super Contributor
Posts: 3,176

Re: How To Attach a webpage on my email?

Posted in reply to Cynthia_sas
Personally have been unsuccessful with packaging an EMAIL with attachments, containing a combination of related "files" (HTML, GIF or other image files) that comprise a "webpage". It's definitely possible, but the recipient must first save all of the attachments to a file-directory location, and then launch the primary "index" page. An example would be one where there is a combination of SAS-generated FRAME/CONTENTS HTML documents and also graphic-image files to render as part of the "webpage".

A better approach I found was to generate the web-publishing content to a web-server location, and then send an EMAIL with an imbedded link to the prmary page.

Scott Barry
SBBWorks, Inc.
Posts: 9,371

Re: How To Attach a webpage on my email?

I agree. It is sort of a pain to try to keep all the files together. One solution in SAS 9.2 is to use ODS PACKAGE destination to make a zip archive of all the files you need for a job and then to email the zip archive as the attachment. Of course, you have to be able to send and your recepients need to be able to receive zip files, but that is an alternative.

There's some 9.2 code below to test. You would then use the .ZIP file name with the ATTACH= option for EMAIL and all the files created for ODS HTML -- the main file and all the image files will be together.


ods listing close;
ods package open;
ods html package file="allstuff.html" style=analysis;

*** proc gchart or other SAS/GRAPH proc;

ods html close;
ods package publish archive properties(archive_name="" archive_path="./");
ods package close clear;
ods _all_ close;
** If you have SAS Package Reader installed ;
** you can name the file with the .SPK extension.;

Frequent Contributor
Posts: 78

Re: How To Attach a webpage on my email?

Posted in reply to Cynthia_sas
Hi Cynthia,

Thanks heaps for your help. It worked Smiley Happy Just if anyone need this piece of code... I got something like that :

/********** Email To ***********************/
Filename Test Email To = '' Type='Text/html'
Subject = 'Report';
/***** Your html page starts here which will be view by the receipients *****/
ODS Markup Body = Test Style = SASWEB;
Title 'This is my title on my html';
PUT 'Hello Good Day;
Ask a Question
Discussion stats
  • 4 replies
  • 3 in conversation