SYSODSPATH Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
SYSPARM Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
SYSPBUFF Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
SYSPRINTTOLIST Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . 221
SYSPRINTTOLOG Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . 221
SYSPROCESSID Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
SYSPROCESSMODE Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . 222
SYSPROCESSNAME Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . 223
SYSPROCNAME Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
SYSRC Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
SYSSCP and SYSSCPL Automatic Macro Variables . . . . . . . . . . . . . . . . . . . . . . 224
SYSSCPL Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
SYSSITE Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
SYSSIZEOFLONG Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
SYSSIZEOFPTR Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
SYSSIZEOFUNICODE Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . 228
SYSSTARTID Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
SYSSTARTNAME Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
SYSTCPIPHOSTNAME Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . 229
SYSTIME Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
SYSTIMEZONE Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
SYSTIMEZONEIDENT Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . 230
SYSTIMEZONEOFFSET Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . 231
SYSUSERID Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
SYSVER Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
SYSVLONG Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
SYSVLONG4 Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
SYSWARNINGTEXT Automatic Macro Variable . . . . . . . . . . . . . . . . . . . . . . . . 234
Automatic Macro Variables
Automatic macro variables are created by the macro processor and they supply a variety
of information. They are useful in programs to check the status of a condition before
executing code.
Dictionary
SYSADDRBITS Automatic Macro Variable
Contains the number of bits of an address.
Type: Automatic macro variable (read only)
Details
The SYSADDRBITS automatic macro variable contains the number of bits needed for
an address.
198 Chapter 14 Automatic Macro Variables
SYSBUFFR Automatic Macro Variable
Contains text that is entered in response to a %INPUT statement when there is no corresponding macro
variable.
Type: Automatic macro variable (read and write)
Details
Until the first execution of a %INPUT statement, SYSBUFFR has a null value.
However, SYSBUFFR receives a new value during each execution of a %INPUT
statement, either the text entered in response to the %INPUT statement where there is no
corresponding macro variable or a null value. If a %INPUT statement contains no macro
variable names, all characters entered are assigned to SYSBUFFR.
Example: Assigning Text to SYSBUFFR
This %INPUT statement accepts the values of the two macro variables WATRFALL and
RIVER:
%input watrfall river;
If you enter the following text, there is not a one-to-one match between the two variable
names and the text:
Angel Tributary of Caroni
For example, you can submit these statements:
%put WATRFALL contains: *&watrfall*;
%put RIVER contains: *&river*;
%put SYSBUFFR contains: *&sysbuffr*;
After execution, they produce this output in the SAS log:
WATRFALL contains: *Angel*
RIVER contains: *Tributary*
SYSBUFFR contains: * of Caroni*
As the SAS log demonstrates, the text stored in SYSBUFFR includes leading and
embedded blanks.
SYSCC Automatic Macro Variable
Contains the current condition code that SAS returns to your operating environment (the operating
environment condition code).
Type: Automatic macro variable (read and write)
See: “Automatic Macro Variables in UNIX Environments” in SAS Companion for UNIX
Environments
“Automatic Macro Variables” in SAS Companion for Windows
“Macro Variables” in SAS Companion for z/OS
SYSCC Automatic Macro Variable 199
Details
SYSCC is a read and write automatic macro variable that enables you to reset the job
condition code and to recover from conditions that prevent subsequent steps from
running.
A normal exit internally to SAS is 0. The host code translates the internal value to a
meaningful condition code by each host for each operating environment. &SYSCC of 0
at SAS termination is the value of success for that operating environment's return code.
The following are examples of successful condition codes:
Table 14.1 SYSCC Operating Environments and Values
Operating Environment Value
z/OS RC 0
OpenVMS $STATUS = 1
The method to check the operating environment return code is host dependent.
The warning condition code in SAS sets &SYSCC to 4.
Note: When the ERRORCHECK= SAS system option is set at NORMAL, the value of
SYSCC will be 0 even if an error exists in a LIBNAME or FILENAME statement, or
in a LOCK statement in SAS/SHARE software. The value of SYSCC will also be 0
when the %INCLUDE statement fails due to a nonexistent file. For more
information, see the “ERRORCHECK= System Option” in SAS System Options:
Reference.
SYSCHARWIDTH Automatic Macro Variable
Contains the character width value.
Type: Automatic macro variable (read only)
Details
The character width value is either 1 (narrow) or 2 (wide).
SYSCMD Automatic Macro Variable
Contains the last unrecognized command from the command line of a macro window.
Type: Automatic macro variable (read and write)
Details
The value of SYSCMD is null before each execution of a %DISPLAY statement. If you
enter a word or phrase on the command line of a macro window and the windowing
environment does not recognize the command, SYSCMD receives that word or phrase as
200 Chapter 14 Automatic Macro Variables
its value. This method is the only way to change the value of SYSCMD, which
otherwise is a read-only variable. Use SYSCMD to enter values on the command line
that work like user-created windowing commands.
Example: Processing Commands Entered in a Macro
Window
The macro definition START creates a window in which you can use the command line
to enter any windowing command. If you enter an invalid command, a message informs
you that the command is not recognized. When you type QUIT on the command line, the
window closes and the macro terminates.
%macro start;
%window start
#5 @28 'Welcome to the SAS System'
#10 @28 'Type QUIT to exit';
%let exit = 0;
%do %until (&exit=1);
%display start;
%if &syscmd ne %then %do;
%if %upcase(&syscmd)=QUIT %then %let exit=1;
%else %let sysmsg=&syscmd not recognized;
%end;
%end;
%mend start;
SYSDATASTEPPHASE Automatic Macro Variable
Indicates the current running phase of the DATA step.
Type: Automatic macro variable (read only)
Details
Macros are designed to only execute during the compilation of a DATA step or during
the execution of a DATA step. The new automatic macro variable
SYSDATASTEPPHASE ensures that the macro is being executed as part of the proper
phase of a DATA step.
The value of SYSDATASTEPPHASE automatic macro variable indicates the current
active phase of the DATA step. When the DATA step is not active, the value of
SYSDATASTEPPHASE is null. The following are possible values of
SYSDATASTEPPHASE automatic macro variable :
INITIALIZATION
COMPILATION
RESOLUTION
EXECUTION
AUTO-LOADING STORED PROGRAM
COMPILATION — STORED PROGRAM LOADING
LOADING STORED PROGRAM
SYSDATASTEPPHASE Automatic Macro Variable 201
AUTO-SAVING STORED PROGRAM
SAVING STORED PROGRAM
Any non-null value, other than EXECUTION, should be considered as part of the DATA
step compilation process.
Examples
Example 1: EXECUTION Phase
24 data null;
25 x=1;
26 /* Placing the argument in single quote marks delays the */
27 /* evaluation until after the DATA step has been compiled. */
28 call execute('%put &sysdatastepphase;');
29 put x=;
30 run;
EXECUTION
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.01 seconds
x=1
Example 2: COMPILATION Phase
1 data null;
2 call symput("phase", "&sysdatastepphase");
3 run;
NOTE: The data set WORK.NULL has 1 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
4
5 %put &=phase;
PHASE=COMPILATION
SYSDATE Automatic Macro Variable
Contains the date on which a SAS job or session began executing.
Type: Automatic macro variable (read only)
See: “SYSDATE9 Automatic Macro Variable” on page 203
Details
SYSDATE contains a SAS date value in the DATE7. format, which displays a two-digit
date, the first three letters of the month name, and a two-digit year. The date does not
change during the individual job or session. For example, you could use SYSDATE in
202 Chapter 14 Automatic Macro Variables
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset