Chapter Contents

Previous

Next
SYSTEM

SYSTEM



Issues an operating environment command during a SAS session

OS/390 specifics: command, related commands, statements, macros


Syntax
Details
Example 1
Example 2
See Also

Syntax

SYSTEM(command)

command
can be a system command enclosed in quotes, an expression whose value is a system command, or the name of a character variable whose value is a system command. Under OS/390, the term system command refers to TSO commands, CLISTs, and REXX execs.


Details

The SYSTEM function is similar to the X (or TSO) statement, the X (or TSO) command, the CALL SYSTEM (or CALL TSO) routine, and the %SYSEXEC (or %TSO) macro statement. In most cases, the X statement, the X command, or the %SYSEXEC macro statement are preferable because they require less overhead.

This function returns the operating environment return code after the command, CLIST, or REXX exec is executed.

SAS executes the SYSTEM function immediately. Under OS/390, TSO is an alias for the SYSTEM function. On other operating environments, the TSO function has no effect, whereas the SYSTEM function is always processed.

You can use the SYSTEM function to issue most TSO commands or to execute CLISTs or REXX execs. However, you cannot issue the TSO commands LOGON and LOGOFF, and you cannot execute CLISTs that include the TSO ATTN statement.


Example 1

In the following example, the SYSTEM function is used to allocate an external file:

data _null_;
   rc=system('alloc f(study) da(my.library)');
run;

For a fully qualified data set name, use the following statements:

data _null_;
   rc=system("alloc f(study)
      da('userid.my.library')");
run;


Example 2

In the second example, notice that the command is enclosed in double quotes. When the TSO command includes quotes, it is best to enclose the command in double quotes instead of single quotes. If you choose to use single quotes, then double each quote in the TSO command:

data _null_;
   rc=system('alloc f(study)
       da(''userid.my.library'')');
run;

See Also


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.