GENMAX= Data Set Option

Requests generations for a new data set, modifies the number of generations for an existing data set, and specifies the maximum number of versions.

Valid in: DATA step and PROC steps
Category: Data Set Control
Restriction: Use with output data sets only.

Syntax

Syntax Description

number-of-generations

requests generations for a data set and specifies the maximum number of versions to maintain. The value can be from 0 to 1,000. The default is GENMAX=0, which means that no generation data sets are requested.

Details

You use GENMAX= to request generations for a new data set and to modify the number of generations for an existing data set. The first time the data set is replaced, SAS keeps the replaced version and appends a four-character version number to its member name. The member name includes # and a three-digit number. For example, for a data set named A, a historical version would be A#001.
After generations of a data set are requested, the member name is limited to 28 characters (rather than 32). The last four characters are reserved for the appended version number. When the GENMAX= data set option is set to 0, the member name can be up to 32 characters.
If you reduce the number of generations for an existing data set, SAS deletes the oldest versions above the new limit.

Examples

Example 1: Requesting Generations When You Create a Data Set

The DATA step creates a data set named Work.A that can have as many as 10 generations (one current version and nine historical versions):
data a(genmax=10);
   x=1;
   output;
run;

Example 2: Modifying the Number of Generations on an Existing Data Set

The number of generations on the data set MYLIB.A is changed to 4:
proc datasets lib=mylib;
   modify a(genmax=4);
run;

See Also

Understanding Generation Data Sets in SAS Language Reference: Concepts
Data Set Option: