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.

Directing <strong>SAS</strong> Log and <strong>SAS</strong> Procedure Output Sending Procedure Output as E-Mail 141<br />

/* Specify the URLs to have the .html extension. */<br />

/* Specify the PATH to be the PDSE. */<br />

/* Specify RS=NONE to write one line of HTML per record. */<br />

/* This is necessary when e-mailing the HTML output. */<br />

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

ods html frame=’shoes1f’<br />

contents=’shoes1c’ (url=’shoes1c.html’)<br />

body=’shoes1b’ (url=’shoes1b.html’)<br />

path=odsout<br />

rs=none;<br />

data newshoes;<br />

set sashelp.shoes;<br />

where Region in (’Canada’ ’Central America/Caribbean’<br />

’South America’ ’United States’);<br />

run;<br />

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

/* sort the data set and generate the report */<br />

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

proc sort data=newshoes;<br />

by Region Subsidiary Product;<br />

run;<br />

options nobyline;<br />

title1 ’Sales <strong>for</strong> Regions #byval(Region)’;<br />

proc report data=newshoes nowindows;<br />

by Region;<br />

column Region Product Subsidiary Sales;<br />

define Region / noprint group;<br />

define Product / display group;<br />

define Subsidiary / display group;<br />

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

compute after Region;<br />

Product=’Total’;<br />

endcomp;<br />

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

run;<br />

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

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

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

ods html close;<br />

ods listing;<br />

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

/* E-mail the report */<br />

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

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

subject="Shoe report 1"<br />

type="text/plain"<br />

attach=(".mvsmail1.pdse(shoes1f)" content_type=’text/html’ extension=’html’<br />

".mvsmail1.pdse(shoes1c)" content_type=’text/html’ extension=’html’<br />

".mvsmail1.pdse(shoes1b)" content_type=’text/html’ extension=’html’) ;

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

Saved successfully!

Ooh no, something went wrong!