DBGEN_NAME= LIBNAME Statement Option

Specifies how SAS automatically renames columns that contain characters that SAS does not allow, such as $, to valid SAS column names.
Valid in: LIBNAME statement
Default: DBMS
Supports: All

Syntax

DBGEN_NAME= DBMS | SAS

Syntax Description

DBMS
specifies that the columns are renamed to valid SAS column names. Disallowed characters are converted to underscores. If a column is converted to a name that already exists, a sequence number is appended to the end of the new name.
SAS
specifies that DBMS columns are renamed to the format _COLn, where n is the column number (starting with zero). The LIBNAME option PRESERVE_COL_NAMES=YES and the global option VALIDVARNAME=ANY must also be specified.

Details

SAS retains column names when it reads data from tables, unless a column name contains characters that SAS does not allow. When the engine reads column names that contain characters that are not allowed in SAS names, the default behavior is to replace an unsupported character with an underscore.
For example, if you specify DBGEN_NAME=SAS, a DBMS column named Dept$Amt is renamed to _COLn. If you specify DBGEN_NAME=DBMS, the Dept$Amt column is renamed to Dept_Amt.
Note: SAS does not allow names that include blank spaces or special characters such as @,#,%, $ unless the VALIDVARNAME option is set to ANY.
When the engine encounters a DBMS name that exceeds 32 characters, it truncates the name.
This option is intended primarily for National Language Support, notably for the conversion of kanji to English characters. English characters that are converted from kanji are often those that are not allowed in SAS.

See Also

To apply this option to an individual table, use the DBGEN_NAME= data set option.