BookmarkSubscribeRSS Feed
mkSAS1
Calcite | Level 5

Why do we need VALIDVARNAME=V7?  If this option is not included, is there any issue?Thank you for your comment.

5 REPLIES 5
PaigeMiller
Diamond | Level 26

According to the SAS documentation

 

VALIDVARNAME=V7 | UPCASE | ANY

Syntax Description

V7

specifies that variable names must follow these rules:

  • The name can be up to 32 characters.
  • The first character must begin with a letter of the Latin alphabet (A - Z, a - z) or the underscore. Subsequent characters can be letters of the Latin alphabet, numerals, or underscores.
  • Trailing blanks are ignored. The variable name alignment is left-justified.
  • A variable name cannot contain blanks or special characters except for the underscore.
  • A variable name can contain mixed-case letters. SAS stores and writes the variable name in the same case that is used in the first reference to the variable. However, when SAS processes a variable name, SAS internally converts it to uppercase. Therefore, you cannot use the same variable name with a different combination of uppercase and lowercase letters to represent different variables. For example, cat, Cat, and CAT all represent the same variable.
  • Do not assign variables the names of special SAS automatic variables (such as _N_ and _ERROR_) or variable list names (such as _NUMERIC_, _CHARACTER_, and _ALL_) to variables.

And when you ask "Why do we need VALIDVARNAME=V7?" you may or may not need it, its an option you can choose, but you can also choose other options based on your current needs. Depending on what user interface you are accessing SAS through, some default to VALIDVARNAME=V7, while other interfaces use a different default, or you may want to change the default if that makes more sense in your situation.

--
Paige Miller
mkSAS1
Calcite | Level 5
Dear Paige,

Thank you so much for your explanation that educated me to have better
insight on the option.

Thank you again for your help.

Best,
Mike
WarrenKuhfeld
Ammonite | Level 13

If you have an old program that runs correctly with a default of VALIDVARNAME=V7, it might not run correctly anymore if you switch to an environment that has VALIDVARNAME=ANY as a default. So you can change your job or change the option.

mkSAS1
Calcite | Level 5
Thank you so much for your comment!
Ksharp
Super User
VALIDVARNAME=V7 could apply to all the module of SAS.
But VALIDVARNAME=ANY is only available to SAS/Base and SAS/Stat. If you are using other module like SAS/OR , SAS/IML that might generate some error info.