SAS Names and Support for DBMS Names |
Length of Name |
SAS naming conventions allow long names for SAS data sets and SAS variables. For example, MYDB.TEMP_EMPLOYEES_QTR4_2000 is a valid two-level SAS name for a data set.
The names of the following SAS language elements can be up to 32 characters in length:
members of SAS libraries, including SAS data sets, data views, catalogs, catalog entries, and indexes
The following SAS language elements have a maximum length of eight characters:
For a complete description of SAS naming conventions, see the SAS Language Reference: Dictionary.Case Sensitivity |
When SAS encounters mixed-case or case-sensitive names in SAS code, SAS stores and displays the names as they are specified. If the SAS variables, Flight and dates, are defined in mixed case--for example,
input Flight $3. +3 dates date9.;
then SAS displays the variable names as defined. Note how the column headings appear as defined:
Mixed-Case Names Displayed in Output
SAS System Obs Flight dates 1 114 01MAR2000 2 202 01MAR2000 3 204 01MAR2000
Although SAS stores variable names as they are defined, it recognizes variables for processing without regard to case. For example, SAS processes these variables as FLIGHT and DATES. Likewise, renaming the Flight variable to "flight" or "FLIGHT" would result in the same processing.
SAS Name Literals |
A SAS name literal is a name token that is expressed as a quoted string, followed by the letter n . Name literals enable you to use special characters or blanks that are not otherwise allowed in SAS names when you specify a SAS data set or variable. Name literals are especially useful for expressing database column and tables names that contain special characters.
Here are two examples of name literals:
data mydblib.'My Staff Table'n; data Budget_for_1999;
input '$ Amount Budgeted'n 'Amount Spent'n;
Name literals are subject to certain restrictions.
You can use a name literal only for SAS variable and data set names, statement labels, and DBMS column and table names.
You can use name literals only in a DATA step or in the SQL procedure.
If a name literal contains any characters that are not allowed when VALIDVARNAME=V7, then you must set the system option to VALIDVARNAME=ANY. For details about using the VALIDVARNAME= system option, see VALIDVARNAME= System Option.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.