|The DATASETS Procedure|
REPAIR SAS-file-1 <...SAS-file-n>
specifies one or more SAS data sets or catalogs in the procedure input library. You can also use a numbered range list or colon list. For more information, see Data Set Lists.
provides the alter password for any alter-protected SAS files that are named in the REPAIR statement. You can use the option either in parentheses after the name of each SAS file or after a forward slash.
|See also:||Using Passwords with the DATASETS Procedure|
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.
restricts processing to one member type.
|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 for Processing|
The most common situations that require the REPAIR statement are as follows:
A system failure occurs while you are updating a SAS data set or catalog.
The device on which a SAS data set or an associated index resides is damaged. In this case, you can restore the damaged data set or index from a backup device, but the data set and index no longer match.
The disk that stores the SAS data set or catalog becomes full before the file is completely written to disk. You might need to free some disk space. PROC DATASETS requires free space when repairing SAS data sets with indexes and when repairing SAS catalogs.
An I/O error occurs while you are writing a SAS data set or catalog entry.
When you use the REPAIR statement for SAS data sets, it recreates all indexes for the data set. It also attempts to restore the data set to a usable condition, but the restored data set might not include the last several updates that occurred before the system failed. You cannot use the REPAIR statement to recreate 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 might 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 might have truncated data.
To repair a damaged catalog, the version of SAS that you use must be able to update the catalog. Whether a SAS version can update a catalog (or just read it) is determined by the SAS version that created the catalog:
A damaged Version 6 catalog can be repaired with Version 6 only.
A damaged Version 8 catalog can be repaired with either Version 8 or SAS 9, but not with Version 6.
A damaged SAS 9 catalog can be repaired with SAS 9 only.
If the REPAIR operation is not successful, try to restore the SAS data set or catalog from your system's backup files.
If you issue a REPAIR statement for a SAS file that does not exist in the specified library, PROC DATASETS stops processing the run group that contains the REPAIR statement, and issues an error message. To override this behavior and continue processing, use the NOWARN option in the PROC DATASETS statement.
If you are using Cross-Environment Data Access (CEDA) to process a damaged foreign SAS data set, CEDA cannot repair it. CEDA does not support update processing, which is required in order to repair a damaged data set. To repair the foreign file, you must move it back to its native environment. Note that observations might be lost during the repair process. For more information about CEDA, refer to "Processing Data Using Cross-Environment Data Access" in SAS Language Reference: Concepts.