Chapter Contents


The DATASETS Procedure

REPAIR Statement

Attempts to restore damaged SAS data sets or catalogs to a usable condition.

REPAIR SAS-file(s)
</ <ALTER=alter-password>

Required Arguments

specifies one or more SAS data sets or catalogs in the procedure input library.


provides the alter password for any alter-protected SAS files that are named in the REPAIR statement. You can use the ALTER= option in parentheses after the name of each SAS file or after a forward slash.
See also: Using Passwords with the DATASETS Procedure

restricts processing to the specified generation files. Valid values for GENNUM= are

postive integer
refers to an explicit generation file.

negative integer
refers to a relative generation file.

restricts processing to one member type (mtype).
Aliases: MT=, MTYPE=
Default: If you do not specify the MEMTYPE= option in the PROC DATASETS statement or in the REPAIR statement, the default is MEMTYPE=ALL.
See also: Restricting Member Types Available for Processing

The most common situations that require the REPAIR statement are described here:

When you use the REPAIR statement for SAS data sets, it re-creates all indexes for the data set. It also attempts to restore the data set to a usable condition, but the restored data set may not include the last several updates that occurred before the system failed. You cannot use the REPAIR statement to re-create indexes that were destroyed by using the FORCE option in a PROC SORT step.

When you use the REPAIR statement for a catalog, you receive a message stating whether the REPAIR statement restored the entry. If the entire catalog is potentially damaged, the REPAIR statement attempts to restore all the entries in the catalog. If only a single entry is potentially damaged, for example when a single entry is being updated and a disk-full condition occurs, on most systems only the entry that is open when the problem occurs is potentially damaged. In this case, the REPAIR statement attempts to repair only that entry. Some entries within the restored catalog may not include the last updates that occurred before a system crash or an I/O error. The REPAIR statement issues warning messages for entries that may have truncated data.

If the REPAIR operation is not successful, try to restore the SAS data set or catalog from your system's backup files.

The REPAIR statement can reference only a specific file to be repaired. Therefore, when you are referring to generation files, ALL, HIST, and REVERT cannot be used with the GENNUM= option.

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.