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. You reference automatic macro variables such as &SYSLAST or
&SYSJOBID the same way you do macro variables that you create.
CAUTION:
Do not create macro variable names that begin with SYS. The three-letter prefix
SYS is reserved for use by SAS for automatic macro variables. For a complete list of
reserved words in the macro language, see Appendix 1, “ Reserved Words in the
Macro Facility,” on page 391.
For example, suppose you want to include the day and date that your current SAS
session was invoked. Write the FOOTNOTE statement to reference the automatic macro
variables SYSDAY and SYSDATE9:
footnote "Report for &sysday, &sysdate9";
If the current SAS session was invoked on June 13, 2007, macro variable resolution
causes SAS to see this statement:
FOOTNOTE "Report for Friday, 13JUN2007";
All automatic variables except for SYSPBUFF are global and are created when you
invoke SAS. The following table lists the automatic macro variables and describes their
Read and Write status.
Table 12.9 Automatic Macro Variables
Variable Read and Write Status
SYSADDRBITS Read-only
SYSBUFFR Read and write
SYSCC Read and write
SYSCHARWIDTH Read-only
SYSCMD Read and write
SYSDATASTEPPHASE Read-only
SYSDATE Read-only
SYSDATE9 Read-only
SYSDAY Read-only
SYSDEVIC Read and write
Automatic Macro Variables 167