Chapter Contents |
Previous |
Next |
%SYSEXEC |
Type: | Macro statement | ||
Restriction: | Allowed in macro definitions or open code | ||
See also: |
|
Syntax | |
Details | |
Comparisons | |
Example | |
Executing Operating Environment-Specific Utility Programs |
Syntax |
%SYSEXEC<command>; |
Details |
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. (See "Example.")
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.
Comparisons |
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.
Example |
In this macro, ACLIB, the %SYSEXEC statement executes
one of two operating environment utility programs based on the value of the
automatic macro variable SYSSCP. If the value of SYSSCP is anything other
than
OS
or
VMS
, ACLIB writes a message in the SAS log indicating that no utilities
are available.
%macro aclib; %if %upcase(&sysscp)=OS %then %sysexec ex 'dept.tools.clist(tiefiles)'; %else %if %upcase(&sysscp)=VMS %then %sysexec @tiefiles; %else %put NO UTILITIES AVAILABLE ON &sysscp..; %mend aclib;
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.