The RENAME statement
sets or modifies the SAS variable name that is associated with a DBMS
column.
Two factors affect the
use of the RENAME statement: whether you specify the ASSIGN statement
when you are creating an access descriptor, and the type of descriptor
that you are creating.
-
If you omit the ASSIGN statement
or specify it with a
NO
value, the renamed
SAS variable names that you specify in the access descriptor are retained
when an ACCESS procedure executes. For example, if you rename the
CUSTOMER column to CUSTNUM when you create an access descriptor, the
column is still named CUSTNUM when you select it in a view descriptor
unless you specify another RESET or RENAME statement.
When you create a view
descriptor that is based on this access descriptor, you can specify
the RESET statement or another RENAME statement to rename the variable.
However, the new name applies only in that view. When you create other
view descriptors, the SAS variable names are derived from the access
descriptor.
-
If you specify the
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 the access 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 this
statement:
rename
7 birthdy 'firstname'=fname;
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.