| SAS Companion for the CMS Environment |
In addition to being able to submit SAS
language statements
from a SASMACRO, you can use a SASMACRO to temporarily pass interactive control
to the SAS session. This environment, called SAS SUBSET, is similar in concept
to CMS SUBSET. A SASMACRO (or any REXX program executed while a SASMACRO is
active that has ADDRESS SAS in effect), can pass control to SAS SUBSET by
issuing the following directive:
'++SAS'
To exit SAS SUBSET and return to the suspended exec,
submit the following SAS statement:
cmsreturn;
CMSRETURN is accepted as a valid SAS statement only
when SAS SUBSET is in effect, and it cannot be submitted from a SASMACRO.
The following example demonstrates switching from a
SAS session to an XEDIT session to SAS SUBSET and back again using a SASMACRO
and an XEDIT macro.
The program named SASXEDIT SASMACRO shows how to temporarily
pass control to XEDIT:
/* SASXEDIT SASMACRO - a SAS REXX macro */
/* that invokes XEDIT */
parse upper arg argstring
address command 'XEDIT' argstring
exit
The following program named SASSUB XEDIT shows how to
temporarily pass control to SAS SUBSET:
/* SASSUB XEDIT - an XEDIT macro */
/* that enters SAS SUBSET */
address sas '++SAS'
/* use CMSRETURN; to get back to XEDIT */
exit rc
From the Program Editor window, submit the following
statement:
sasxedit FILENAME FILETYPE FILEMODE;
This invokes SASXEDIT SASMACRO, which places you into
an XEDIT session. At the XEDIT command line enter:
sassub
This invokes SASSUB XEDIT which puts you in SAS SUBSET
in the Program Editor window as a continuation of your SAS session. Next submit
this SAS statement:
cmsreturn;
This ends SAS SUBSET and resumes XEDIT, which runs the
remaining portion of SASSUB XEDIT and then lets you continue your XEDIT session.
Ending the XEDIT session (using FILE or QUIT) passes control back to the original
SAS session, which runs the remaining portion of SASXEDIT SASMACRO and then
returns you to the Program Editor window where you started.
Flow of Control
illustrates the flow of control among
the original SAS session, the XEDIT session, and the SAS SUBSET session.
Flow of Control
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.