BookmarkSubscribeRSS Feed
sreeparna93
Calcite | Level 5

Hi 

I want to add a dataset in table format in the email body as well as add text to format the email. 

right now I am only add the dataset and unable to add texts. 

 

result.html has the dataset output in html format

The code is below:

FILENAME Mailbox EMAIL "&email"
Subject='Test Mail message'
content_type="text/html";

DATA _NULL_;

FILE Mailbox;
infile "/home/sm25967/DQ_2/QVCDE_QC_Report/result.html";
input;
RUN;
filename Mailbox clear;
 
2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

There was a similar question earlier today, my response was:

A good way to data into an email is to put it out from a dataset:

filename mailbox email 'someone@world.com'
  subject='Total Sales';
data _null_;
  file mailbox;
  set your_data;
  if _n_=1 then do;
    put "Hello";
    put "This is a the Total Sales";
  end;
  put _all_;
run;
filename mailbox clear;

You can find further examples, such as attaching reports, here:

http://www2.sas.com/proceedings/forum2008/038-2008.pdf

Kurt_Bremser
Super User

I'd use ODS HTML to create the complete body of the email (including tables and free text).

Then do

data _null_;
file Mailbox;
infile "/home/sm25967/DQ_2/QVCDE_QC_Report/result.html";
input;
put _infile_;
run;

That way your whole mail body is formatted as HTML, and the mail agents will understand that because the mail body starts with a <HTML> tag.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 3063 views
  • 0 likes
  • 3 in conversation