DATASETS Procedure

CHANGE Statement

Renames one or more SAS files in the same SAS library.
Manipulating SAS Files

Syntax

Required Argument

old-name=new-name
changes the name of a SAS file in the input data library. old-name must be the name of an existing SAS file in the input data library.

Optional Arguments

ALTER=alter-password
provides the Alter password for any alter-protected SAS files named in the CHANGE statement. Because a CHANGE statement changes the names of SAS files, you need Alter access to use the CHANGE statement for new-name. You can use the option either in parentheses after the name of each SAS file or after a forward slash.
GENNUM=ALL | integer
restricts processing for generation data sets. You can use the option either in parentheses after the name of each SAS file or after a forward slash. The following list shows valid values:
ALL | 0
refers to the base version and all historical versions of a generation group.
integer
refers to a specific version from a generation group. Specifying a positive number is an absolute reference to a specific generation number that is appended to a data set's name (that is, gennum=2 specifies MYDATA#002). Specifying a negative number is a relative reference to a historical version in relation to the base version, from the youngest to the oldest (that is, gennum=-1 refers to the youngest historical version).
For example, the following statements change the name of version A#003 to base B:
proc datasets;    
   change A=B / gennum=3;  

proc datasets;    
   change A(gennum=3)=B;
The following CHANGE statement produces an error:
proc datasets;    
   change A(gennum=3)=B(gennum=3);
MEMTYPE=mtype
restricts processing to one member type. You can use the option either in parentheses after the name of each SAS file or after a forward slash.
Alias:MTYPE=, MT=
Default:If you do not specify MEMTYPE= in the PROC DATASETS statement, the default is MEMTYPE=ALL.

Details

The CHANGE statement changes names by the order in which the old-names occur in the directory listing, not in the order in which you list the changes in the CHANGE statement.
If the old-name SAS file does not exist in the SAS library, PROC DATASETS stops processing the RUN group containing the CHANGE statement and issues an error message. To override this behavior, use the NOWARN option in the PROC DATASETS statement.
If you change the name of a data set that has an index, the index continues to correspond to the data set.