BookmarkSubscribeRSS Feed
hasnasherin
Fluorite | Level 6

I know how to send emails using the FILENAME EMAIL statement in SAS. However, I'm looking for guidance on displaying a SAS dataset as a formatted table directly in the email body?

1 REPLY 1
ChrisHemedinger
Community Manager

You can format your email using ODS and HTML. See the examples in How to send email using SAS.


Excerpt:

FILENAME OUTPUT EMAIL
	SUBJECT = "blogs.sas.com: &postCount posts, 
                  &commentCount comments"
	FROM = "Chris Hemedinger <[email protected]>"
	TO = (&toList)
	CT ='text/html';

ods tagsets.msoffice2k(id=email)
  file=OUTPUT(title="7-day blog report")
  style=myemail;

proc report nowd data=pastweek;
  title "&postCount blogs.sas.com posts";
  title2 color=red "NOTE: " color=blue "View counts are sourced from Google Analytics";
  columns post_date post_author blog_ID post_link ga_views comment_count ;
  define post_date / group order=data 'Date posted' style(column)=[just=l];
  define post_author / order 'Author' style(column)=[just=l];
...
run;
ods tagsets.msoffice2k(id=email) close;

 

Become an Explorer! Join SAS Analytics Explorers to learn and complete challenges that earn rewards!

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 403 views
  • 2 likes
  • 2 in conversation