As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Automatic variables

From sasCommunity
Jump to: navigation, search
This is a work in progress. Please contribute to this article.

During the DATA Step there are several variables that exist automatically and can be used within the DATA Step to provide information about the state of processing. These are DATA Step variables, rather than macro variables.

Automatic variables in the DATA Step

  • _N_
  • _ERROR_
  • BY Groups
    • FIRST.variable
    • LAST.variable
  • MODIFY statement
    • _IORC_
  • WINDOW statement
    • _CMD_
    • _MSG_

Automatic macro variables

See the article Automatic macro variables for more information.

There are also automatic macro variables that provide information about the SAS system. However, macro variables are parsed (resolved) when the code for the DATA Step is compiled but are only updated when the DATA Step runs. Consequently it is often difficult and inconvenient to access the current value of a macro variable or update the value as 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. (One needs to use special functions and call routines to access macro variables dynamically within the DATA Step.)