Data Set Options for Relational Databases |
Alias: | PRESERVE_NAMES= (see "Details") |
Default value: | LIBNAME setting |
Valid in: | DATA and PROC steps (when creating DBMS tables using SAS/ACCESS software). |
DBMS support: | Aster nCluster, DB2 under UNIX and PC Hosts, DB2 under z/OS, Greenplum, Informix, Microsoft SQL Server, MySQL, Netezza, ODBC, OLE DB, Oracle, Sybase IQ, Teradata |
Syntax | |
Syntax Description | |
Details | |
See Also |
Syntax |
PRESERVE_COL_NAMES=YES | NO |
specifies that column names that are used in DBMS table creation are derived from SAS variable names by using the SAS variable name normalization rules. (For more information see the VALIDVARNAME= system option.) However, the database applies its DBMS-specific normalization rules to the SAS variable names when it creates the DBMS column names.
The use of name literals to create column names that use database keywords or special symbols other than the underscore character might be illegal when DBMS normalization rules are applied. To include nonstandard SAS symbols or database keywords, specify PRESERVE_COL_NAMES=YES.
specifies that column names that are used in table creation are passed to the DBMS with special characters and the exact, case-sensitive spelling of the name preserved.
Details |
This option applies only when you use SAS/ACCESS to create a new DBMS table. When you create a table, you assign the column names by using one of these methods:
To control the case of the DBMS column names, specify variables with the desired case and set PRESERVE_COL_NAMES=YES. If you use special symbols or blanks, you must set VALIDVARNAME=ANY and use name literals. For more information, see the naming topic in this document and also the system options section in SAS Language Reference: Dictionary.
To enable the DBMS to normalize the column names according to its naming conventions, specify variables with any case and set PRESERVE_COLUMN_NAMES=NO.
When you use SAS/ACCESS to read from, insert rows into, or modify data in an existing DBMS table, SAS identifies the database column names by their spelling. Therefore, when the database column exists, the case of the variable does not matter.
For more information, see the SAS/ACCESS naming topic in the DBMS-specific reference section for your interface.
To save some time when coding, specify the PRESERVE_NAMES= alias if you plan to specify both the PRESERVE_COL_NAMES= and PRESERVE_TAB_NAMES= options in your LIBNAME statement.
To use column names in your SAS program that are not valid SAS names, you must use one of these techniques:
Use the DQUOTE= option in PROC SQL and then reference your columns using double quotation marks. For example:
proc sql dquote=ansi; select "Total$Cost" from mydblib.mytable;
Specify the global VALIDVARNAME=ANY system option and use name literals in the SAS language. For example:
proc print data=mydblib.mytable; format 'Total$Cost'n 22.2;
libname mydblib oracle user=testuser password=testpass; proc sql dquote=ansi; create table mydblib.mytable (preserve_col_names=yes) ("my$column" int);
PRESERVE_COL_NAMES= does not apply to the Pass-Through Facility.
See Also |
To assign this option to a group of relational DBMS tables or views, see the naming in your interface for the PRESERVE_COL_NAMES= LIBNAME Option.
SAS Names and Support for DBMS Names
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.