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.

274 SYSTEM Function Chapter 13<br />

SYSTEM Function<br />

Issues an operating environment command during a <strong>SAS</strong> session and returns the system return<br />

code<br />

Category: Special<br />

z/<strong>OS</strong> specifics: command, related commands, statements, macros<br />

See: SYSTEM Function in <strong>SAS</strong> Language Reference: Dictionary<br />

Syntax<br />

SYSTEM(command)<br />

command<br />

can be a system command enclosed in quotation marks, an expression whose value is<br />

a system command, or the name of a character variable whose value is a system<br />

command. Under z/<strong>OS</strong>, the term system command refers to TSO commands, CLISTs,<br />

and REXX execs.<br />

Details<br />

The SYSTEM function is similar to the X (or TSO) statement, the X (or TSO) command,<br />

the CALL SYSTEM (or CALL TSO) routine, and the %SYSEXEC (or %TSO) macro<br />

statement.<br />

This function returns the operating environment return code after the command,<br />

CLIST, or REXX exec is executed.<br />

<strong>SAS</strong> executes the SYSTEM function immediately. Under z/<strong>OS</strong>, TSO is an alias <strong>for</strong><br />

the SYSTEM function. On other operating environments, the TSO function has no<br />

effect, whereas the SYSTEM function is always processed.<br />

You can use the SYSTEM function to issue most TSO commands or to execute<br />

CLISTs or REXX execs. However, you cannot issue the TSO commands LOGON and<br />

LOGOFF, and you cannot execute CLISTs that include the TSO ATTN statement.<br />

You must use the TSO command, TSOEXEC, to execute authorized commands.<br />

Examples<br />

In the following example, the SYSTEM function is used to allocate an external file:<br />

data _null_;<br />

rc=system(’alloc f(study) da(my.library)’);<br />

run;<br />

For a fully qualified data set name, use the following statements:<br />

data _null_;<br />

rc=system("alloc f(study) da(’userid.my.library’)");<br />

run;<br />

In the second example above, notice that the command is enclosed in double<br />

quotation marks. When the TSO command includes quotation marks, it is best to<br />

enclose the command in double quotation marks. If you choose to use single quotation<br />

marks, then double each single quotation mark within the TSO command:

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

Saved successfully!

Ooh no, something went wrong!