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 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 might 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 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
Definition of Cross-Environment Data Access (CEDA) in SAS Language Reference: Concepts.