Previous Page | Next Page

The DATASETS Procedure

REBUILD Statement


Specifies whether to restore or delete the disabled indexes and integrity constraints.
Default: Rebuild indexes and integrity constraints
Restriction: Data sets created in Version 7 or later

REBUILD SAS-file </ ALTER=password GENNUM=n MEMTYPE=mtype NOINDEX>;

Required Argument

SAS-file

specifies a SAS data file that contains the disabled indexes and integrity constraints. You can also use a numbered range list or colon list. For more information, see Data Set Lists.


Options

ALTER=alter-password

provides the alter password for any alter-protected SAS files that are named in the REBUILD statement. You can use the option either in parentheses after the name of each SAS file or after a forward slash.

GENNUM=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. Valid value is integer, which 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; 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. Specifying 0, which is the default, refers to the base version.

See also: "Understanding Generation Data Sets" in SAS Language Reference: Concepts
MEMTYPE=mtype

restricts processing to one member type.

Aliases: MT=, MTYPE=
Default: If you do not specify the MEMTYPE= option in the PROC DATASETS statement or in the REBUILD statement, the default is MEMTYPE=ALL.
NOINDEX

specifies to delete the disabled indexes and integrity constraints.

Restriction: The NOINDEX option cannot be used for data files that contain one or more referential integrity constraints.

Details

When the DLDMGACTION=NOINDEX data set or system option is specified and SAS encounters a damaged data file, SAS does the following:

The REBUILD statement completes the repair of a damaged SAS data file by rebuilding or deleting all of the data file's disabled indexes and integrity constraints. The REBUILD statement establishes and uses member-level locking in order to process the new index file and to restore the indexes and integrity constraints.

To rebuild the index file and restore the indexes and integrity constraints, use the following code:

proc datasets library=mylib 
rebuild myfile
/alter=password
 gennum=n
 memtype=mytype;

To delete the disabled indexes and integrity constraints, use the following code:

proc datasets library=mylib
rebuild myfile /noindex;

After you execute the REBUILD statement, the data file is no longer restricted to INPUT mode.

The REBUILD statement default is to rebuild the indexes and integrity constraints and the index file.

If a data file contains one or more referential integrity constraints and you use the NOINDEX option with the REBUILD statement, the following error message is written to the SAS log:

Error: Unable to rebuild data file MYLIB.MYFILE.DATA using the 
              NOINDEX option because the data file contains referential 
              constraints. Resubmit the REBUILD statement without the 
              NOINDEX option to restore the data file.

Previous Page | Next Page | Top of Page