“Type” column tells you if the variable can be changed (Read and Write) or can be
inspected (Read Only).
Table 11.2 Automatic Macro Variables with Host-Specific Results
Task
Automatic Macro
Variable Type
List the name of the current graphics device
on DEVICE=.
SYSDEVIC Read and write
List of the mode of execution (values are
FORE or BACK). Some host environments
allow only one mode, FORE.
SYSENV Read-only
List the name of the currently executing
batch job, user ID, or process. For example,
on UNIX, SYSJOBID is the PID.
SYSJOBID Read-only
List the last return code generated by your
host environment, based on commands
executed using the X statement in open code.
The X command in the SAS windowing
environment, or the %SYSEXEC (or %TSO
or %CMS) macro statements.
The default value is 0.
SYSRC Read and write
List the abbreviation of the host environment
that you are using.
SYSSCP Read-only
List a more detailed abbreviation of the host
environment that you are using.
SYSSCPL Read-only
Retrieve a character string that was passed to
SAS by the SYSPARM= system option.
SYSPARM Read and write
Time zone name based on TIMEZONE
option.
SYSTIMEZONE Read-only
Time zone ID based on TIMEZONE option. SYSTIMEZONEIDENT Read-only
Current time zone offset based on
TIMEZONE option.
SYSTIMEZONEOFFSET Read-only
Examples Using SYSSCP and SYSSCPL
The macro DELFILE uses the value of SYSSCP to determine the platform that is
running SAS and deletes a TMP file. FILEREF is a macro parameter that contains a
filename. Because the filename is host-specific, making it a macro parameter enables the
macro to use whatever filename syntax is necessary for the host environment.
%macro delfile(fileref);
/* Unix */
%if &sysscp=HP 800 or &sysscp=HP 300 %then %do;
X “rm &fileref..TMP”;
%end;
150 Chapter 11 • Writing Efficient and Portable Macros