Previous Page | Next Page

Macro Statements

%SYSEXEC Statement

Issues operating environment commands.
Type: Macro statement
Restriction: Allowed in macro definitions or open code
See also:

SYSSCP and SYSSCPL Automatic Macro Variables

SYSRC Automatic Macro Variable




no argument

puts you into operating environment mode under most operating environments, where you can issue operating environment commands and return to your SAS session.


is any operating environment command. If command contains a semicolon, use a macro quoting function.


The %SYSEXEC statement causes the operating environment to immediately execute the command you specify and assigns any return code from the operating environment to the automatic macro variable SYSRC. Use the %SYSEXEC statement and the automatic macro variables SYSSCP and SYSSCPL to write portable macros that run under multiple operating environments.

Operating Environment Information:   These items related to the use of the %SYSEXEC statement are operating environment specific:

For details, see the SAS documentation for your operating environment.  [cautionend]


The %SYSEXEC statement is analogous to the X statement and the X windowing environment command. However, unlike the X statement and the X windowing environment command, host commands invoked with %SYSEXEC should not be enclosed in quotation marks.

Previous Page | Next Page | Top of Page