X Statement: z/OS

Issues an operating environment command during a SAS session.
Valid in: Anywhere
z/OS specifics: Issues a TSO command or invokes a CLIST or a REXX exec
See: X Statement in SAS Statements: Reference

Syntax

X <command> ;
X XEQ: pgmname <parms> ;
X AEQ: pgmname <parms> ;
X WEQ: pgmname <parms> ;
X Ann: pgmname <parms> ;
X Wnn: pgmname <parms> ;

Details

Under z/OS, the X and TSO statements are identical when the AEQ, Ann, WEQ, and Wnn prefixes are omitted. On other operating environments, the TSO statement has no effect, whereas the X statement is always processed.
When a prefix that contains a colon is included in the X statement, it executes a user program synchronously or asynchronously. It can also execute multiple user programs in concurrent asynchronous mode.
Synchronous execution
The example below attaches the program mypgm, passes it to myparms, and does not return until the program completes processing. All of the text between mypgm and the terminating semicolon are considered to be parameters.
X XEQ: mypgm myparms;
Asynchronous execution
The example below attaches the program mypgm, passes it to myparms, and returns to a SAS prompt while the program executes.
X AEQ: mypgm myparms;
data x;x=1;run;
proc print;run;
X WEQ:;
Note: You can use the WEQ: prefix in a subsequent X statement to cause SAS to wait for the program to complete before continuing.
Concurrent asynchronous execution
The example below attaches two programs, executes some more SAS statements, and waits for each to execute separately. To wait for a particular program to execute, issue an X Wnn: statement where the value of nn is the same as the value of the nn in the corresponding X Ann: statement.
X A01: pgm1 parms1;
X A02: pgm2 parms2;
data x;x=1;run;
proc print;run;
X W02:;
X W01:;