Chapter Contents

Previous

Next
%SYSEXEC

%SYSEXEC



Issues operating environment commands

Type: Macro statement
Restriction: Allowed in macro definitions or open code
See also:
SYSSCP and SYSSCPL
SYSRC


Syntax
Details
Comparisons
Example
Executing Operating Environment-Specific Utility Programs

Syntax

%SYSEXEC<command>;

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.

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


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.  [cautionend]


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

Example 1: Executing Operating Environment-Specific Utility Programs

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.