The RENAME statement enters or modifies the SAS
column name that is associated with a
DBMS column. The RENAME statement can be used when creating an
access descriptor or a
view descriptor. However, the value of the ASSIGN statement affects when the RENAME statement can
be used.
When you create an access descriptor, the default setting for a SAS column name is
a blank. When ASSIGN=YES, default SAS column names are generated and these
SAS column names are used by all of the
view descriptors derived from this access descriptor. You can use the RENAME statement
to edit the SAS column names assigned in the access descriptor and these renamed SAS
column are used by its view descriptors, unless a RESET statement or another RENAME
statement is used in the access descriptor.
If you omit the ASSIGN
statement or specify it with a NO
value, you can use the RENAME statement to assign a SAS column name. In this case,
the SAS column names that you enter in the access descriptor are retained by any view
descriptors derived from this access descriptor. However, you can edit them in the
view descriptor with the RENAME statement. Column names renamed in the view descriptor
apply only
to that view descriptor.
The
column-identifier argument can be either the CA-Datacom/DB
field 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 column
names that are
associated with the seventh DBMS column and the nine-character FIRSTNAME DBMS 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 column name on the right side. The equal sign (=) is optional. If the
CA-Datacom/DB field name contains special characters or national characters, enclose
the name in quotation
marks. 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 column name associated
with a DBMS column, you do not have to issue a SELECT statement for that column.