BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
I am trying to send an email from the datastep, I have a sample program that generates the email and sends it. That works great! However, I would like to have the body of the email display in HTML, currently I get the text display (I see the html tags. If I save the text to a file and open that with a browser it displays as I want.) What I want is the email body to display as formatted HTML.

Here is the start/end of the body of the message
 Dear Gerry ,
...





and the code I use including the filename and portionst of the datasetep:

filename mailbox email to="&memail1"
subject ='test email'
type="text/html";
data _null_;
set list end=lastobs;
file mailbox;
if _n_ = 1 then do;

put ''
''
''
'
';
end;

/* Heading using name*/
pname=trim("&mname1")!! ' ,';
put 'Dear ' pName;

...
* write out close of html;

if lastobs then do;
put '
'
''
'';
end;

Run;

Is there a way to send the body of an email from the data step as HTML?
I looked, and there is lots of great info about emailing from SAS, but I could not find a way to format the datastep body as html. There is lots to show as a file attachment, or PROC output, neither of which works for me.
Erik has a great paper at http://www2.sas.com/proceedings/forum2008/038-2008.pdf
but that doesn't help with using the data step to create HTML as the body of the email.
Thanks for any info,
Gerry
1 REPLY 1
Bill
Quartz | Level 8
Does this help?

filename gwc email ' '
to=("galvwarmerreport@hamilton.ca")
subject="Galvanize Warmer Consumption for &start to &end"
type="text/html";


data _null_;

file gwc;
put "

another SAS® powered auto e-mail report from Quality Systems";
put "
";
put "
Click on the link below to view/print file contents";
put "
";
put "

HREF='\\MOFtp\MainFrameFtp\EsaDown\GalvWarmerTracking.pdf'>
Galvanize Warmer Cons...

";
put "
";
put "
";
put "
Questions, comments or concerns?";
put "
Send reply email to: Quality Systems Reports";
run; This didn't display properly. Let me try again.


Message was edited by: Bill

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1 reply
  • 1443 views
  • 0 likes
  • 2 in conversation