Macro Statements


The following macro statement has behavior specific to Windows:

%SYSEXEC

  • 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 Windows or MS-DOS Commands from within SAS' on page 25. You can use the %SYSEXEC statement inside a macro or in open code. The %SYSEXEC statement has the following syntax:

    • %SYSEXEC < command >;

  • 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: 

    Note: The %SYSEXEC statement uses the XSYNC and XWAIT system option values just like the X statement and X command do. For more information about these system options, see 'XSYNC System Option' on page 576 and 'XWAIT System Option' on page 577.




SAS 9.1 Companion for Windows
SAS 9.1 Companion for Windows (2 Volumes)
ISBN: 1590472004
EAN: 2147483647
Year: 2004
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net