Previous Page | Next Page

SAS Data Set Options

GENNUM= Data Set Option



Specifies a particular generation of a SAS data set.
Valid in: DATA step and PROC steps
Category: Data Set Control
Restriction: Use with input data sets only.

Syntax
Syntax Description
Details
Examples
Example 1: Requesting a Version Using an Absolute Reference
Example 2: Requesting A Version Using a Relative Reference
See Also

Syntax

GENNUM=integer


Syntax Description

integer

is a number that references 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. Specifying a negative number is a relative reference to a historical version in relation to the base version, from the youngest to the oldest. Typically, a value of 0 refers to the current (base) version.

Note:   The DATASETS procedure provides a variety of statements for which specifying GENNUM= has additional functionality:

  • For the DATASETS and DELETE statements, GENNUM= supports the additional values ALL, HIST, and REVERT.

  • For the CHANGE statement, GENNUM= supports the additional value ALL.

  • For the CHANGE statement, specifying GENNUM=0 refers to all versions rather than just the base version.

  [cautionend]

Details

After generations for a data set have been requested using the GENMAX= data set option, use GENNUM= to request a specific version. For example, specifying GENNUM=3 refers to the historical version #003, while specifying GENNUM=-1 refers to the youngest historical version.

Note that after 999 replacements, the youngest version would be #999. After 1,000 replacements, SAS rolls over the youngest version number to #000. Therefore, if you want the historical version #000, specify GENNUM=1000.

Both an absolute reference and a relative reference refer to a specific version. A relative reference does not skip deleted versions. Therefore, when working with a generation group that includes one or more deleted versions, using a relative reference results in an error if the version being referenced has been deleted. For example, if you have the base version AIR and three historical versions (AIR#001, AIR#002, and AIR#003) and you delete AIR#002, the following statements return an error, because AIR#002 does not exist. SAS does not assume you mean AIR#003:

proc print data=air (gennum= -2);
run;


Examples


Example 1: Requesting a Version Using an Absolute Reference

This example prints the historical version #003 for data set A, using an absolute reference:

proc print data=a(gennum=3);
run;


Example 2: Requesting A Version Using a Relative Reference

The following PRINT procedure prints the data set three versions back from the base version:

proc print data=a(gennum=-3);
run;


See Also

Data Set Option:

GENMAX= Data Set Option

Understanding Generation Data Sets in SAS Language Reference: Concepts

The DATASETS Procedure in Base SAS Procedures Guide

Previous Page | Next Page | Top of Page