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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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