Help using Base SAS procedures

Formatting email body text, and proc print output

Reply
Senior User
Posts: 1

Formatting email body text, and proc print output

I have working code which runs daily and generates an email with an attached excel file. Included in the body of the email are three tables I populate with proc print. We have significant security constraints which don't allow me to create a permanent template of my own, and I have tried for a few days now to get the body of the email in one font, aligned the way I want it through a number of different methods. Ultimately they all turn out ugly.

 

I'm new to ODS work and completely self taught, so I am certain this is not the best way to do it, any help would be appreciated.

 

I've defined the labels in prior steps and the data tables only contain exactly the variables I need to output. I'm using SAS enterprise guide, version 6.100.0.4180, platform version 9.4.2.0. I access it through multiple (2) jump boxes as a virtual machine and that machine has no internet access (not sure if that matters).

 

Here is the code I use;

FY = Fiscal year I'm running it for

RPT_DT = day I'm running the report

 

ODS _ALL_ CLOSE;
filename OUTPUT email
SUBJECT = "FY&FY. Overall results to date for &RPT_DT."
FROM = 'me@mail.com'
TO = 'endUser@mail.com'
CONTENT_TYPE= 'TEXT/HTML' 
ATTACH = "/prjct1/output/secure/Overall &RPT_NM..XLS";

 

ODS HTML BODY=OUTPUT;

 

TITLE JUSTIFY=LEFT "FY&FY. Overall results to date for &RPT_DT.";
PROC PRINT DATA=SUBTOTAL4 LABEL NOOBS SPLIT='|' ;
RUN;


TITLE JUSTIFY=LEFT "FY&futureFY. National Programs detailed results to date for &RPT_DT.";
PROC PRINT DATA=BASELINE_04 LABEL NOOBS SPLIT='|';
WHERE NATIONAL='National';
RUN;


TITLE "FY&FY. Local Programs detailed results to date for &RPT_DT.";
PROC PRINT DATA=BASELINE_04 LABEL NOOBS SPLIT='|';
WHERE NATIONAL='Local';
RUN;
ODS _ALL_ CLOSE;

 

This code outputs correctly, but its not formatted the way I would like. I've attached a partial screenshot of the output.

Capture output.JPG

 

I'd like to do a number of things... 

  • I would like to get the font and font size to be the same throughout. The Titles are appearing as 10pt Arial, the proc prints are 12pt Times New Roman
  • I'd like to align the printed tables (not their contents) to the left (you'll see in the image the overall results, a smaller table, is centered/indented, while the national is a larger table and fills the email to both margins and I am guessing also centered, but because its larger it begins at the left margin.

Less important, but I feel like I should be able to do these...

  • I would like to put in some introductory text before I output the title and tables
  • I'd like to remove the boxes around the titles
  • I'd like to put a (boxless) footer at the bottom (I am able to do so using the code below, but it shows up as boxed

ODS HTML TEXT = " ";
ODS HTML TEXT = "Corporate Analytics - &RPT_DT.";
ODS HTML TEXT = " ";
ODS HTML TEXT = "NOTICE: This e-mail (and any attachments) may be confidential and proprietary. It is for the sole use of the intended recipient(s) and any use or disclosure by others is prohibited. If you are not the intended recipient(s), please notify the sender by return e-mail and delete all copies of this e-mail (and any attachments).";
ODS HTML CLOSE;

 

Thank you,

Bill

 

 

PROC Star
Posts: 2,329

Re: Formatting email body text, and proc print output

Posted in reply to Bill_dunno

> I would like to get the font and font size to be the same throughout.   

   google this: proc print style

 

> I'd like to align the printed tables (not their contents) to the left 

   Try:  option nocenter;

 

I think your other concerns are more difficult to address, requiring changing ODS styles.

Try:  ODS html style=default  I think it doesn't box titles. 

 

If you find no style that suits your needs you may have to modify the styles.

Ask a Question
Discussion stats
  • 1 reply
  • 1097 views
  • 0 likes
  • 2 in conversation