Returns the value of an EXEC variable
- 'argument'
- is the name of the EXEC variable. It must
be uppercased and enclosed in quotes.
The GETEXEC function is a SAS DATA step
function that returns the value of an EXEC variable. The EXEC must be written
in EXEC2 or REXX.
Here are some points to consider when you are using
the GETEXEC function:
- All EXEC variable names that are specified as
arguments for GETEXEC must be in uppercase. This is true for REXX as well
as EXEC2, even though REXX makes no distinction between upper- and lowercase
in its variable names. If you specify a REXX compound symbol, such as NAME.1,
as an argument, only the stem (the part of the name preceding the period)
must be in uppercase.
- Although EXEC2 variables always begin with an
ampersand (&), you must omit the ampersand when you use the name as an
argument.
- The CMS EXEC processor hides all variables except
those in the current EXEC. Hidden variables are not accessible by GETEXEC.
- Arguments to GETEXEC must be character values,
and the values of EXEC variables, even numeric values, are always retained
in character format. By default, SAS converts values automatically from numeric
to character or character to numeric. However, it is better to use the DATA
step functions INPUT and PUT to convert character values from EXEC variables
to a specific numeric format, and vice versa.
- If the interface to EXEC variables fails, GETEXEC
assumes that its arguments are invalid (because no EXEC variables can be accessed),
and a message is written to the SAS log.
If an EXEC2 variable name used as an argument to GETEXEC
does not exist, the GETEXEC function returns a missing value. If a REXX variable
name that was used as an argument to the GETEXEC function does not exist,
the GETEXEC function returns the name of the variable. For either EXEC2 or
REXX, if the variable has a null value or a value of all blanks, GETEXEC returns
a missing value.
The following statement assigns the value
of the EXEC variable LABEL to the SAS variable DISKID:
diskid=getexec('LABEL');
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.