When generation data sets are used, you must create the integrity constraints in each data
set generation that includes protected variables.
CAUTION:
CHECK constraints in SAS 9.2 are not compatible with earlier releases of SAS.
If you add a CHECK constraint to an existing SAS data set or create a SAS data set
that includes a CHECK constraint, the data set cannot be accessed by a release prior
to SAS 9.2.
Specifying Physical Location for Inter-Libref Referential Integrity
Constraints When Sharing Disk Space
When you share disk space over a network and access referential integrity constraints in
which the foreign key and primary key data files are in different SAS libraries, a
standard should be established for the physical location of the shared files. A standard is
required when you create the shared files so that network machines use the same
physical name in order to access the files. If the physical names do not match, SAS
cannot open the referenced foreign key or primary key SAS data file.
For example, a standard might be established that all shared files are placed on disk T: so
that network machines use the same pathname in order to access the files.
Here is an example of a problem regarding files that were created without a standard.
Suppose a primary key and a foreign key SAS data file were created on machine D4064
in different directories C:Publicpkey_directory and C:Public
fkey_directory
. The pathnames are stored in the descriptor information of the SAS
data files.
To access the primary key data file from a different machine such as F2760, the
following LIBNAME statement would be executed:
libname pkds '\D4064Publicpkey_directory';
When the primary key data file is opened for update processing, SAS automatically tries
to open the foreign key data file by using the foreign key data file's physical name that is
stored in the primary key data file, which is C:Publicfkey_directory.
However, that directory does not exist on machine F2760. Therefore, opening the foreign
key data file fails.
Listing Integrity Constraints
PROC CONTENTS and PROC DATASETS report integrity constraint information
without special options. In addition, you can print information about integrity constraints
and indexes to a data set by using the OUT2= option. In PROC SQL, the DESCRIBE
TABLE and DESCRIBE TABLE CONSTRAINTS statements report integrity constraint
characteristics as part of the data file definition or alone, respectively. SCL provides the
ICTYPE, ICVALUE, and ICDESCRIBE functions for getting information about
integrity constraints. For more information see Base SAS Procedures Guide and SAS
Component Language: Reference for more information.
Rejected Observations
You can customize the error message that is associated with an integrity constraint when
you create the constraint by using the MESSAGE= and MSGTYPE= options. The
MESSAGE= option enables you to prepend a user-defined message to the SAS error
message associated with an integrity constraint. The MSGTYPE= option enables you to
Understanding Integrity Constraints 631