BookmarkSubscribeRSS Feed
ArthurTrubshaw
Fluorite | Level 6

Hi,

I have a piece of SAS code that generates a simple eMail with an embedded Proc Print/Report.

 

The code below produces the eMail and the report OK, but as you can see from the screenshot, there are several blank lines at the top of the eMail message and also the TITLE1 from the Proc Report does not appear. 

 

1) How do I ensure that the three text lines appear at the top of the eMail message ?

2) How do I get my TITLE1 to appear above the Proc Report ?

ArthurTrubshaw_1-1712799128379.png

 

The demo code that I am using is shown below. I am using HTML3 as the ODS destination because HTML, HTML4 and HTML5 produce even worse results and all of them feature these blank lines at the start of the message.

 

*************************************************************************;
*Define the Fileref thorugh which to send our eMail........ ;
*************************************************************************;
Filename MyMail
eMail
To = "&g_eMail_Recipient"
From = "&g_eMail_Sender"
Subject = "FRED - Using SAS Styles Demo- with Embedded Proc Report - Journal (HTML3)"
Content_Type = "text/html"
;
ODS _ALL_ CLOSE;

ODS HTML3 BODY=MyMail STYLE=Journal;


OPTIONS NOCENTER;

/*OPENING TEXT*/
ods text="This is Line #1 of the eMail body text.";
ods text="This is Line #2 of the eMail body text.";
ods text="This is Line #3 of the eMail body text.";


TITLE1 "SAS Report Title goes here.";
PROC REPORT DATA = SASHELP.CLASS(OBS=5);
COLUMNS _ALL_;
DEFINE _ALL_ / DISPLAY CENTER;
RUN;

TITLE;

ods text="This is the final line of the eMail. Goodbyeeeeeee!";


****************************************************************;
*Close the ODS HTML destination and re-open the standard output.;
****************************************************************;
ODS HTML3 CLOSE;
ODS LISTING;

*************************************************************************;
*Clear the FileRef. ;
*************************************************************************;
Filename MyMail Clear;

Any thoughts as to how to get my message to start at the top of the eMail instead of half-way down it ?

I have played with using Proc ODSTEXT instead of the ODS TEXT statements, but the results are the same.

 

Cheers,

 

ArthurT

 

 

2 REPLIES 2
whymath
Lapis Lazuli | Level 10
Have you tried ods html other than ods html3? and also try to open email in web browser other than outlook, just to ensure outlook display the same with web browser.
ArthurTrubshaw
Fluorite | Level 6

Hello Whymath,

Yes, I have tried each of HTML, HTML4 and HTML5 ODS destinations but get the same blank lines at the start of the eMail whichever destination I chose. I see the same problem when I open any resultant eMails in a browser too.

 

ArthurT

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 2 replies
  • 522 views
  • 0 likes
  • 2 in conversation