Example 7. DTS: Transferring Data Set Integrity Constraints

Purpose

Integrity constraints are a set of data validation rules that preserve the consistency and correctness of the stored data. These rules are defined by the applications programmer and are enforced by SAS for each request to modify the data.
PROC UPLOAD and PROC DOWNLOAD permit a transferred SAS data set to inherit the characteristics of the input data set. If the OUT= option is omitted when transferring a specific SAS data set, the transferred data set inherits the characteristics of the input data set. A transferred data set also inherits the characteristics of the input data set if it is part of a library transfer. For details about the INLIB= and OUTLIB= options for PROC UPLOAD, see PROC UPLOAD Statement ; for details about PROC DOWNLOAD, see DOWNLOAD Procedure .
PROC UPLOAD and PROC DOWNLOAD apply integrity constraints to the transfer of data sets. As with other data set characteristics, integrity constraints are inherited by a transferred data set under specific conditions. The only exception is that, if the input file has an index defined and the user specifies the INDEX=NO option, any integrity constraints that are defined for the input file are not inherited. Also, referential integrity constraint types are not transferred when the referential constraints reside in a different library.

Example 7.1: Omitting the OUT= Option from the PROC DOWNLOAD Statement

This example downloads the SAS data set REM in the library WORK on the server to the library WORK on the client. Any non-referential integrity constraints that are defined for the input data set are inherited by the output data set.
proc download data=rem;
run;

Example 7.2: Using the DROP= Option in the PROC UPLOAD Statement

This example uploads the SAS data set LOC in the library WORK on the client to the library WORK on the server. The variable ONE is dropped from the output data set. Any non-referential integrity constraints that are defined for the input data set that do not include the variable ONE are inherited by the output data set.
proc upload data=loc(drop=one);
run;

Example 7.3: Using the INLIB= Option in the PROC UPLOAD Statement

This example uploads all SAS data sets in the library SASUSER on the client and stores them in the library WORK on the server. Any non-referential integrity constraints that are defined for each of the input data sets are inherited by the corresponding output data set.
proc upload inlib=sasuser outlib=work;
run;

Example 7.4: Using the INDEX=NO Option in the PROC DOWNLOAD Statement

This example downloads the SAS data set STUDENTS in the library WORK on the server to the library WORK on the client. Any non-referential integrity constraints that are defined for the input data set are inherited by the output data set unless there are indexes defined on the input data set. In that case, no integrity constraints are defined for the output data set.
proc download data=students index=no;
run;