Chapter Contents

Previous

Next
SAS Companion for the CMS Environment

Retrieving and Assigning the Values of REXX Variables in a SAS Program


Using the GETEXEC DATA Step Function

During the execution of a SASMACRO you can retrieve the value of any exposed REXX variable from the current REXX program into a DATA step by using the GETEXEC function. The GETEXEC function is analogous to the SYMGET function in the SAS macro facility.

The following SASMACRO submits a DATA step that uses the GETEXEC function to retrieve the value of the REXX variable DATALINE. It then prints the value of DATALINE in the SAS log. Note that the REXX variable name must be specified in uppercase letters.

   /* GETLINE SASMACRO - a SAS REXX macro      */
dataline='This data will be placed into the SAS',
             'data set A'
   /* Pass a DATA step to SAS        */
"data a;"
   "x=getexec('DATALINE');"
   "put x;"
"run;"
exit

For more information about the syntax and usage of GETEXEC, see GETEXEC.


Using the PUTEXEC CALL Routine

During the execution of a SASMACRO, you can assign a value to a REXX variable in the current REXX program from a DATA step by using the PUTEXEC call routine. The PUTEXEC call routine is analogous to the SYMPUT routine in the SAS macro facility.

The following SASMACRO submits a DATA step that assigns the value of a SAS variable to the REXX variable SASTIME. The SASMACRO then displays the value of the REXX variable on the console. Note that the REXX variable name must be specified in uppercase letters.

/* PUTTIME SASMACRO - a SAS REXX macro      */
"data _null_;"
   "time=symget('SYSTIME');"
   "call PUTEXEC('SASTIME',time);"
"run;"
say 'SAStime is' sastime
exit

For more information about the syntax and usage of PUTEXEC, see CALL PUTEXEC.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.