DATASETS Procedure

AGE Statement

Renames a group of related SAS files in a library.
Aging SAS Data Sets

Syntax

Required Arguments

current-name
is a SAS file that the procedure renames. current-name receives the name of the first name in related-SAS-file-1 <...related-SAS-file-n>.
related-SAS-file-1 ... <related-SAS-file-n>
is one or more SAS files in the SAS library.

Optional Arguments

ALTER=alter-password
provides the Alter password for any alter-protected SAS files named in the AGE statement. Because an AGE statement renames and deletes SAS files, you need Alter access to use the AGE statement. You can use the option either in parentheses after the name of each SAS file or after a forward slash.
MEMTYPE=mtype
restricts processing to one member type. All of the SAS files that you name in the AGE statement must be the same 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 DATA.

Details

The AGE statement renames the current-name to the name of the first name in the related-SAS-files, renames the first name in the related-SAS-files to the second name in the related-SAS-files, and so on, until it changes the name of the next-to-last SAS file in the related-SAS-files to the last name in the related-SAS-files. The AGE statement then deletes the last file in the related-SAS-files.
If the first SAS file named in the AGE statement does not exist in the SAS library, PROC DATASETS stops processing the RUN group containing the AGE statement and issues an error message. The AGE statement does not age any of the related-SAS-files. To override this behavior, use the NOWARN option in the PROC DATASETS statement.
If one of the related-SAS-files does not exist, the procedure prints a warning message to the SAS log but continues to age the SAS files that it can.
If you age a data set that has an index, the index continues to correspond to the data set.
You can age only entire generation groups. For example, if data sets A and B have generation groups, then the following statement deletes generation group B and ages (renames) generation group A to the name B:
age a b;
For example, suppose the generation group for data set A has three historical versions and the generation group for data set B has two historical versions. Then aging A to B has this effect:
Old Name
Version
New Name
Version
A
base
B
base
A
1
B
1
A
2
B
2
A
3
B
3
B
base
is deleted
B
1
is deleted
B
2
is deleted