The following macro statement
has behavior specific to Windows:
executes operating
environment commands immediately and places the return code in the
SYSRC automatic macro variable. The %SYSEXEC statement is similar
to the X statement that is described in “Running DOS or Windows
Commands from within SAS” in “Getting Started”
in the
SAS Companion for Windows. You can use the %SYSEXEC statement inside a macro
or in open code. The %SYSEXEC statement has the following syntax:
The
command argument can be any operating environment
command or any sequence of macro operations that generates an operating
environment command. You can also use the
command argument to invoke a Windows application such as Notepad.
Omitting the
command argument launches a command prompt subprocess,
which is interactive. To return to your SAS session, type EXIT at
the command prompt and press ENTER. The SYSRC automatic variable
is set to 0 if you omit the
command argument in the %SYSEXEC statement.
Here is a simple example
of %SYSEXEC:
%sysexec time;
This statement launches
a command prompt session that displays the following lines:
The current time is: 16:32:45.16 Enter new time: