Automatic macro variables
Automatic macro variables are macro variables that automatically exist in the SAS environment and are assigned values by the SAS system. They provide information about the state of the SAS system's environment and operating states. The information contained in can be used by SAS programs.
Although most of these macro variables are READONLY, some can be modified by the user.
Listing available variables
To see a list of automatic macro variables currently available within your SAS system you can use a %PUT statement.
%put _automatic_ ;
Most automatic macro variables start with SYS (&SYSDATE9), however some procedures, such as PROC SQL, and some products, such as SAS/AF, will also create automatic macro variables and these may start with other letters.
Automatic variables in the DATA Step
During the DATA Step it is often difficult and inconvenient to access the current value of a macro variable or update the value. This is because macro variables are parsed when the code for the DATA Step is compiled but are only updated when the DATA Step runs. Consequently, the obvious methods of reading and assigning values to macro variables do not work as one would logically expect from an initial reading of the code. To overcome these issues there are several automatic variables that can be used within the DATA Step. These are DATA Step variables, rather than macro variables.
- BY Groups
- MODIFY statement
- WINDOW statement
- SAS(R) 9.4 Macro Language: Reference, Fourth Edition: Automatic Macro Variables
- SAS(R) 9.4 Companion for Windows, Fourth Edition: Automatic Macro Variables
- Using the PROC SQL Automatic Macro Variables: SAS(R) 9.4 SQL Procedure User's Guide, Third Edition
- SYS_SQLSETLIMIT Macro Variable: SAS(R) 9.4 SQL Procedure User's Guide, Third Edition
- Automatic Variables: SAS(R) 9.4 Language Reference: Concepts, Fifth Edition