Previous Page | Next Page

Functions and CALL Routines

SYSTEM Function



Issues an operating environment command during a SAS session, and returns the system return code.
Category: Special
See: SYSTEM Function under z/OS

Syntax
Arguments
Comparisons
Examples
See Also

Syntax

SYSTEM(command)

Arguments

command

specifies any of the following: a system command that is enclosed in quotation marks (explicit character string), an expression whose value is a system command, or the name of a character variable whose value is a system command that is executed.

Operating Environment Information:   See the SAS documentation for your operating environment for information about what you can specify. The system return code is dependent on your operating environment.  [cautionend]

Restriction: The length of the command cannot be greater than 1024 characters, including trailing blanks.

Comparisons

The SYSTEM function is similar to the X statement, the X command, and the CALL SYSTEM routine. In most cases, the X statement, X command, or %SYSEXEC macro statement are preferable because they require less overhead. However, the SYSTEM function can be executed conditionally, and accepts expressions as arguments. The X statement is a global statement and executes as a DATA step is being compiled, regardless of whether SAS encounters a conditional statement.


Examples

Execute the host command TIMEDATA if the macro variable SYSDAY is Friday .

data _null_;
   if "&sysday"="Friday" then do;
      rc=system("timedata");
   end;
   else rc=system("errorck");
run;


See Also

CALL Routine:

CALL SYSTEM Routine

Statement:

X Statement

Previous Page | Next Page | Top of Page