VALIDVARNAME= System Option

Specifies the rules for valid SAS column names that can be created and processed during a SAS session.

Valid in: configuration file, SAS invocation, OPTIONS statement, SAS System Options window
Category: Files: SAS Files
PROC OPTIONS GROUP= SASFILES
Default: V7
Requirement: You must also specify PRESERVE_COL_NAMES=YES LIBNAME statement data source processing option.
Supports: All

Syntax

VALIDVARNAME=V7 | UPCASE | ANY

Syntax Description

V7

specifies that column names must follow these rules:

  • can be up to 32 characters in length.
  • must begin with a letter of the Latin alphabet (A - Z, a - z) or the underscore character. Subsequent characters can be letters of the Latin alphabet, numerals, or underscores.
  • cannot contain blanks.
  • cannot contain special characters except for the underscore.
  • can contain mixed-case letters. SAS stores and writes the column name in the same case that is used in the first reference to the column. However, when SAS processes a column name, SAS internally converts it to uppercase. You cannot, therefore, use the same column name with a different combination of uppercase and lowercase letters to represent different columns. For example, cat, Cat, and CAT all represent the same column.
  • cannot be assigned the names of special SAS automatic columns (such as _N_ and _ERROR_) or column list names (such as _NUMERIC_, _CHARACTER_, and _ALL_).

UPCASE

specifies that the column name follows the same rules as V7, except that the column name is uppercase, as in earlier versions of SAS.

ANY

specifies that SAS column names must follow these rules:

  • can be up to 32 characters in length.
  • can begin with or contain any characters, including blanks.
    Note: If you use any characters other than the ones that are valid when the VALIDVARNAME system option is set to V7 (letters of the Latin alphabet, numerals, or underscores), then you must express the column name as a name literal and you must set VALIDVARNAME=ANY. See “SAS Name Literals” and “Avoiding Errors When Using Name Literals” in SAS Language Reference: Concepts.
  • can contain mixed-case letters. SAS stores and writes the column name in the same case that is used in the first reference to the column. However, when SAS processes a column name, SAS internally converts it to uppercase. You cannot, therefore, use the same column name with a different combination of uppercase and lowercase letters to represent different columns. For example, cat, Cat, and CAT all represent the same column.
Note: For more information about SAS naming, see SAS Language Reference: Concepts.