Chapter Contents

Previous

Next
SAS Macro Language: Reference

Automatic Macro Variables

Automatic macro variables are created by the macro processor and they supply a variety of information. They are useful in programs, for example 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, for example &SYSLAST or &SYSJOBID.

CAUTION:
Do not create macro variable names that begin with SYS. The three-letter prefix SYS is reserved for use by the SAS System for automatic macro variables. For a complete list of reserved words in the macro language, see Appendix 1, Reserved Words in the Macro Facility.  [cautionend]

For example, suppose you want to include today's day and date in a FOOTNOTE statement. Write the statement to reference the automatic macro variables SYSDAY and SYSDATE9, as shown here:

footnote "Report for &sysday, &sysdate9";

If you run the program on June 15, 2001, macro variable resolution causes the SAS System to see this statement:

FOOTNOTE "Report for Friday, 15JUN2001";

All automatic variables except for SYSPBUFF are global and are created when you invoke the SAS System. Automatic Macro Variables lists the automatic macro variables and describes their READ and WRITE status.

Automatic Macro Variables
Variable READ/WRITE Status
SYSBUFFR read/write
SYSCC read/write
SYSCHARWIDTH read only
SYSCMD read/write
SYSDATE read only
SYSDATE9 read only
SYSDAY read only
SYSDEVIC read/write
SYSDMG read/write
SYSDSN read/write
SYSENV read only
SYSERR read only
SYSFILRC read/write
SYSINDEX read only
SYSINFO read only
SYSJOBID read only
SYSLAST read/write
SYSLCKRC read/write
SYSLIBRC read/write
SYSMENV read only
SYSMSG read/write
SYSPARM read/write
SYSPBUFF read/write
SYSPROCESSID read only
SYSPROCESSNAME read only
SYSRC read/write
SYSSCP read only
SYSSCPL read only
SYSSITE read only
SYSSTARTID read only
SYSSTARTNAME read only
SYSTIME read only
SYSUSERID read only
SYSVER read only
SYSVLONG read only


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.