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 Example: Sending E-Mail by Using SCL Code 145<br />

The OPTIONS statement assigns EMAILJOE as the default Universal printer.<br />

EMAILJOE remains the default printer <strong>for</strong> the duration of the <strong>SAS</strong> session, unless<br />

it is overridden by another OPTIONS statement.<br />

3 Identify the print destination to <strong>SAS</strong>:<br />

ods printer;<br />

The ODS PRINTER statement enables procedure output to be <strong>for</strong>matted <strong>for</strong> a<br />

high-resolution printer. Because the ODS PRINTER statement does not specify a<br />

filename or fileref, ODS output is sent to the Universal Printing default printer<br />

(EMAILJOE).<br />

4 Issue a print command or procedure:<br />

proc print data=sashelp.shoes;<br />

where region="Canada";<br />

run;<br />

PROC PRINT generates procedure output in standard ODS <strong>for</strong>mat. The output<br />

is sent to the attachment file associated with EMAILJOE.<br />

5 Remove the print destination:<br />

ods printer close;<br />

The second ODS PRINTER statement removes the ODS print destination. The<br />

procedure output is sent to EMAILJOE, which sends the e-mail message with the<br />

attached file to the e-mail recipient.<br />

The following program defines a registry entry <strong>for</strong> printing procedure output to an<br />

e-mail attachment:<br />

/* STEP 1 */<br />

data printers;<br />

name = ’emailjoe’;<br />

protocol = ’Ascii’;<br />

trantab = ’GTABCMS’;<br />

model = ’PostScript Level 1 (Gray Scale)’;<br />

device = ’EMAIL’;<br />

dest = ’John.Doe@sas.com’;<br />

hostopt = "recfm=vb ct=’application/PostScript’<br />

subject=’Canada Report’ ";<br />

run;<br />

/* STEP 2 */<br />

proc prtdef data=printers replace list;<br />

run;<br />

Example: Sending E-Mail by Using SCL Code<br />

The following example is the SCL code that underlies a frame entry design <strong>for</strong><br />

e-mail. The frame entry includes these text-entry fields:<br />

mailto the user ID of the e-mail recipient<br />

copyto the user ID of the recipient of the e-mail copy (CC)<br />

attach the name of the file to attach<br />

subject the subject of the e-mail message<br />

line1 the text of the e-mail message

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

Saved successfully!

Ooh no, something went wrong!