Chapter Contents |
Previous |
Next |
RENAME |
Optional statement | |
Applies to: | access descriptor or view descriptor |
Interacts with: | ASSIGN, RESET |
Syntax | |
Details |
Syntax |
RENAME
<'>column-identifier-1<'><=>
SAS-variable-name-1
<...<'>column-identifier-n<'><=> SAS-variable-name-n>; |
An editing statement, such as RENAME, must follow the CREATE or UPDATE statement and the database connection statements when you create or update a descriptor. See CREATE for more information on the order of statements.
Two factors affect the use of the RENAME statement: whether you specify the ASSIGN statement when you are creating an access descriptor, and the kind of descriptor you are creating.
NO
value, the renamed SAS variable names that you
specify in the access descriptor are retained throughout an ACCESS procedure
execution. For example, if you rename the CUSTOMER column to CUSTNUM when
you create an access descriptor, that column continues to be named CUSTNUM
when you select it in a view descriptor unless a RESET statement or another
RENAME statement is specified.
When creating a view descriptor that is based on this access descriptor, you can specify the RESET statement or another RENAME statement to rename the variable again, but the new name applies only in that view. When you create other view descriptors, the SAS variable names are derived from the access descriptor.
YES
value in the ASSIGN
statement, you can use the RENAME statement to change SAS variable names only
while creating an access descriptor. As described earlier in the ASSIGN statement,
SAS variable names and formats that are saved in an access descriptor are
always used when creating view descriptors that are based on it.
The column-identifier argument can be either the DBMS column name or the positional equivalent from the LIST statement, which is the number that represents the column's place in the descriptor. For example, to rename the SAS variable names that are associated with the seventh column and the nine-character FIRSTNAME column in a descriptor, submit the following statement:
rename 7 birthdy 'firstname'=fname;
The DBMS column name (or positional equivalent) is specified on the left side of the expression, with the SAS variable name on the right side. The equal sign (=) is optional. If the column name contains lowercase characters, special characters, or national characters, enclose the name in quotes. You can rename as many columns as you want in one RENAME statement.
When you are creating a view descriptor, the RENAME statement automatically selects the renamed column for the view. That is, if you rename the SAS variable associated with a DBMS column, you do not have to issue a SELECT statement for that column.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.