BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
12 REPLIES 12
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
Thanks Cynthia - this is exactly what I was looking for. I appreciate your time.
Joe
deleted_user
Not applicable
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;
deleted_user
Not applicable
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?
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
I expect you need to add QUIT; to your code.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
This has no effect.

I've also tried an ods close _all_ statement with similar lack of success.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
FILENAME OUTBOX CLEAR;

?


Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
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.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
deleted_user
Not applicable
Me too.

To stop it, i have to press the "stop" button in enterprise guide.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest you open a SAS support track, rather than attempt to debug this problem through the discussion forum.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
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

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 12 replies
  • 5364 views
  • 0 likes
  • 3 in conversation