The SAS Output Delivery System and reporting techniques

ODS output in the body of an email

Reply
N/A
Posts: 0

ODS output in the body of an email

I'm trying to figure out a way to send 'ods html' output in the body of an email (not as an attachment).
I'd like to use the email function so that an "anything.html" file created through ods is read as the source file for an email sent through the SAS program (so that when the email is opened, the html formatting is visible within the email body.)
I've searched around for awhile, but I can't find any examples of this out there. Any help or suggestion is appreciated.
Thanks,
Joe
SAS Super FREQ
Posts: 8,864

Re: ODS output in the body of an email

Posted in reply to deleted_user
Hi:
If you go to the online doc and type "email" into the search field, you should find a list of topics related to the FILENAME statement. When all the hits come up, look for a topic with this title:
"Statements: FILENAME Statement, EMAIL (SMTP) Access Method".

In that Help topic, Example 3 is entitled, "Sending Procedure Output in E-mail". The key is using the filename statement with the 'to', 'type' and 'subject' options and the email engine specified. In addition, you have to be sure to specify the RS=NONE option on your ODS invocation.

The example is too long to duplicate here. If you try it out and it doesn't work for you, you might want to contact Tech Support for further help. I believe there are some system options that also have to be set at startup time in order for the email method to work correctly.

Good luck!
cynthia
N/A
Posts: 0

Re: ODS output in the body of an email

Posted in reply to deleted_user
Thanks Cynthia - this is exactly what I was looking for. I appreciate your time.
Joe
N/A
Posts: 0

Re: ODS output in the body of an email

Posted in reply to deleted_user
For anyone else reading this - it was much more consistant for me once I changed to ods markup (SAS documentation uses ods html). The code is below:

filename outbox email
to='email@address.com'
type='text/html'
subject='Temperature Conversions';

data work.temperatures;
do centigrade = -40 to 100 by 10;
fahrenheit = centigrade*9/5+32;
output;
end;
run;

ods markup
body=outbox /* Mail it! */
rs=none tagset=tagsets.html4 style=sasweb;

title 'Centigrade to Fahrenheit Conversion Table';

proc print data=work.temperatures;
id centigrade;
var fahrenheit;
run;

ods markup close;
N/A
Posts: 0

Re: ODS output in the body of an email

Posted in reply to deleted_user
Both this version and the version in the documentation don't terminate properly on our system. We're using Enterprise Guide on windows connected to SAS 9.2 on Unix.

The programme runs without errors and produces the output but doesn't terminate until it is manually stopped.

Any ideas?
Super Contributor
Super Contributor
Posts: 3,174

Re: ODS output in the body of an email

Posted in reply to deleted_user
I expect you need to add QUIT; to your code.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: ODS output in the body of an email

This has no effect.

I've also tried an ods close _all_ statement with similar lack of success.
Super Contributor
Super Contributor
Posts: 3,174

Re: ODS output in the body of an email

Posted in reply to deleted_user
FILENAME OUTBOX CLEAR;

?


Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: ODS output in the body of an email

If i put that above the ods close statement, i get a warning that no email address is specified. If i put it below, it doesn't clear the filename or send the email until i manually stop the programme.
Super Contributor
Super Contributor
Posts: 3,174

Re: ODS output in the body of an email

Posted in reply to deleted_user
Please clarify "..manually stop the programme."? The SAS program you have shown appears to be self-contained. I would expect this code to terminate.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: ODS output in the body of an email

Me too.

To stop it, i have to press the "stop" button in enterprise guide.
Super Contributor
Super Contributor
Posts: 3,174

Re: ODS output in the body of an email

Posted in reply to deleted_user
Suggest you open a SAS support track, rather than attempt to debug this problem through the discussion forum.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: ODS output in the body of an email

Resolved. Solution is to add an ods _all_ close statement at the top of the code. The problem is with Enterprise Guide.

http://support.sas.com/kb/18/635.html
Ask a Question
Discussion stats
  • 12 replies
  • 463 views
  • 0 likes
  • 3 in conversation