02.05.2013 Views

SAS(R) 9.1.3 Companion for z/OS

SAS(R) 9.1.3 Companion for z/OS

SAS(R) 9.1.3 Companion for z/OS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

144 Example: Directing Output as an E-Mail Attachment with Universal Printing Chapter 6<br />

/* sort data set NEWSHOES in order by region */<br />

/* ----------------------------------------- */<br />

proc sort data=newshoes;<br />

by Region Subsidiary Product;<br />

run;<br />

quit;<br />

/* -------------------------------------------- */<br />

/* print a report of shoe sales <strong>for</strong> each Region */<br />

/* -------------------------------------------- */<br />

goptions reset=footnote;<br />

option nobyline;<br />

title ’Sales Report <strong>for</strong> #byval(Region)’;<br />

proc report data=newshoes nowindows;<br />

by Region;<br />

column Region Subsidiary Product Sales;<br />

define Region / noprint group;<br />

define Subsidiary / display group;<br />

define Product / display group;<br />

define Sales / display sum <strong>for</strong>mat=dollar12.;<br />

compute after Region;<br />

Subsidiary=’Total’;<br />

endcomp;<br />

break after Region / summarize style=rowheader page;<br />

run;<br />

/* ------------------------------------------------------ */<br />

/* Close the HTML destination and open the listing output */<br />

/* ------------------------------------------------------ */<br />

ods html close;<br />

ods listing;<br />

/* ---------------- */<br />

/* Email the report */<br />

/* -----------------*/<br />

filename email email ’barney@bedrock.com’<br />

subject="Shoe report 2"<br />

type="text/plain"<br />

attach=("./public_html/shoe_report.html" content_type=’text/html’<br />

"./public_html/shoes1_regsales.html" content_type=’text/html’<br />

"./public_html/shoes1.gif" content_type=’image/gif’) ;<br />

data _null_;<br />

file email;<br />

put ’Here is the latest Shoe sales report’;<br />

run;<br />

Example: Directing Output as an E-Mail Attachment with Universal<br />

Printing<br />

Follow these steps to send procedure output as an attachment to an e-mail message.<br />

1 Define a Universal printer with a device type of ’EMAIL’.<br />

2 Establish a printing destination with the PRINTERPATH= option:<br />

options printerpath=’emailjoe’;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!