BookmarkSubscribeRSS Feed
arunrami
Pyrite | Level 9

Hello ,  I want to insert a table in mail which is automated by SAS, I created a table by using proc report but when output goes to mail table lines has been vanished? I dont know what am missing. could any one help?

Code:

data Temp1;
	set Temp;
	start_time=substr(start_time,1,8);
	start_time=input(start_time,ddmmyy8.);
	call symput('Newdate',start_time);
run;

Data Mail;
set Temp1;
/*if &Newdate>&prevtime;Compare with the previous job start time, comment it while running for very first time*/
run;
%put &Newdate &prevtime;


%let send_email = 0;

* WHEN 0 EMAIL WILL NOT BE SENT. WHEN 1 EMAIL WILL BE SENT;
data New;
	set Mail nobs=No_of_mail;
	count=No_of_mail;

	if count > 0 then
		do;
			call symput('send_email',1);
			stop;

			* LEAVE THE DATASTEP AS SOON AS WE DECIDE AN EMAIL SHOULD BE SENT;
		end;
run;

%macro send_email;
	%if &send_email eq 1 %then
		%do;
			FILENAME MailBox EMAIL

				TO=(
				'Myself <zzz.com>'
				) 
				CC=(
				'Myself <zzz.com>'
				)
				/*BCC=
				'info@synchrona.nl'*/
			FROM='Arun <zzz.com>'
			type='text/html'
			SUBJECT='DAILY_STATUS';

			/*REPLYTO=
				'Anonymous
				<villavinkeveen@hotmail.com>'*/

			/*ATTACH=
				'E:\My Documents\My Pictures\Picture WILLSU.jpg'*/
			ODS html body=Mailbox style = noline;
			ods html text = "DAILY STATUS";
			ods html text = "";

			PROC REPORT DATA=work.MAIL nowd HEADLINE HEADSKIP out=X.Existing
				style (report) = {background = white
				font_face = "Verdana" font_size = 7pt just=left bordercolor=grey rules=All frame=box}
				style (column) = {background = white CELLHEIGHT = 2.5%
				font_face = "Verdana" font_size = 7pt just=left }
				style (header) = {foreground = cx5e2750 font_face="Verdana"
				font_size = 8pt just=left
				};
				columns _All_;
			run;

			ods html text = "Have a Great Day.";
			ods _all_ close;
			run;

		%end;
%mend;

%send_email;

/**/
ods listing ;
/**/
	%global prevtime;
/**/

data X.Final1;
set X.existing;
call symput('prevtime',start_time);
run;
	t:

Result:Capture.PNG

 
 

 

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Searching the communities threads unearths this.

Use TAGSETS.MSOFFICE2K. Outlook is not HTML-friendly. Is not friendly period actually. 🙂

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 1 reply
  • 3426 views
  • 0 likes
  • 2 in conversation