Previous Page | Next Page

Macro Language Elements

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. When you use automatic macro variables, you reference them the same way that you do macro variables that you create such as &SYSLAST or &SYSJOBID.

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 Reserved Words in the Macro Facility.  [cautionend]

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.

Automatic Macro Variables
Variable Read and Write Status
SYSBUFFR read and write
SYSCC read and write
SYSCHARWIDTH read-only
SYSCMD read and write
SYSDATE read-only
SYSDATE9 read-only
SYSDAY read-only
SYSDEVIC read and write
SYSDMG read and write
SYSDSN read and write
SYSENCODING read-only
SYSENV read-only
SYSERR read-only
SYSERRORTEXT read only
SYSFILRC read and write
SYSHOSTNAME read-only
SYSINDEX read-only
SYSINFO read-only
SYSJOBID read-only
SYSLAST read and write
SYSLCKRC read and write
SYSLIBRC read and write
SYSLOGAPPLNAME read-only
SYSMACRONAME read-only
SYSMENV read-only
SYSMSG read and write
SYSNCPU read-only
SYSODSPATH read-only
SYSPARM read and write
SYSPBUFF read and write
SYSPROCESSID read-only
SYSPROCESSNAME read-only
SYSPROCNAME read-only
SYSRC read and write
SYSSCP read-only
SYSSCPL read-only
SYSSITE read-only
SYSSTARTID read-only
SYSSTARTNAME read-only
SYSTCPIPHOSTNAME read-only
SYSTIME read-only
SYSUSERID read-only
SYSVER read-only
SYSVLONG read-only
SYSVLONG4 read-only
SYSWARNINGTEXT read-only

Previous Page | Next Page | Top of Page