The SAS Output Delivery System and reporting techniques

Creating webpages and emailing them

Reply
N/A
Posts: 0

Creating webpages and emailing them

Hi all. Just curious if anybody has a more efficient way than the method I'm using to create web pages and email them. What I do is this. I'll have a macro with an ODS HTML statement that generates an html file based on a series of proc reports. I'll then run the same macro a second time, but with a different parameter that points the "body" to send an email instead of create a file. At the end of the job, I call an FTP program to upload the file to an offsite webserver.

So, basically, I'm executing everything twice. Is there a simpler way to send an html email based on an existing html file? Thanks for any suggestions.
SAS Super FREQ
Posts: 8,868

Re: Creating webpages and emailing them

Posted in reply to deleted_user
Hi:
My favorite method for sending email is to send the report as an attachment using code something like this:
[pre]

** step 1: make the report;
ods html body='c:\temp\class.html style=sasweb;

proc print data=sashelp.class;
title 'Emailed This ODS HTML File';
run;

ods html close;

** step 2: email the report with an explanatory note;

filename doemail email
to=('One.Person@sas.com' 'another.person@sas.com')
from='Me@sas.com'
cc=('You@sas.com')
subject='Testing attach of ODS HTML output'
attach='c:\temp\class.html';

data _null_;
file doemail;
put 'This is a test email with the report as an attachment. ';
put 'The report will be on the web server tomorrow';
run;

[/pre]

The advantage of this method is that you could (if you had write access to the web server) write the file directly to the web server. In your case, since you are FTP'ing the file to the web server -- you could create one copy of the report in your FTP location and then email -that copy- as the attachment. You'd only create the file one time.

cynthia

ps...if you search support.sas.com, there are a lot of hits on emailing with SAS and I believe there are also several SUGI and SGF papers on the topic, too.
N/A
Posts: 0

Re: Creating webpages and emailing them

Posted in reply to Cynthia_sas
I am also trying to send files via email and it works when I use internal email id's but I get errors when I insert email id's for external customers. Do I need to change my code to send to outside users??? Thanks,,
SAS Super FREQ
Posts: 8,868

Re: Creating webpages and emailing them

Posted in reply to deleted_user
Hi:
Using my mail server, I AM able to send emails to external customers. You may need to check with your mail administrators on this one. There's nothing in the SAS program that prevents you from using an external email address. And then SAS just passes the addresses to whichever email server was defined as being the one to use. If there's a different server that allows external email IDs, then you'd have to get your SAS session pointed to that server.

cynthia
N/A
Posts: 0

Re: Creating webpages and emailing them

Posted in reply to deleted_user
Our email administrators keep us on our toes, as from time to time our emails from z/OS stop getting through. The latest issue was having to code the FROM parameter (as in Cynthia’s example) so that the server knows it’s coming from an internal address. (Our TCP/IP and SMTP parameters suggest otherwise.)
Ask a Question
Discussion stats
  • 4 replies
  • 167 views
  • 0 likes
  • 2 in conversation