ENCRYPT= Data Set Option

Specifies whether to encrypt an output SPD Engine data set.

Valid in: DATA step and PROC step
Default: NO
Restrictions: Use only with output data sets
ENCRYPT=YES or ENCRYPT=AES cannot be used with COMPRESS=

Syntax

ENCRYPT= AES | NO | YES

Syntax Description

AES

encrypts the data set using the AES (Advanced Encryption Standard) algorithm. AES provides stronger encryption using SAS/SECURE software, which is included with Base SAS software. You must use the ENCRYPTKEY= data set option when using ENCRYPT=AES. For more information, see ENCRYPTKEY= Data Set Option.

CAUTION:
Record all ENCRYPTKEY= key values if you specify ENCRYPT=AES.
If you forget the ENCRYPTKEY= key value, you lose your data. SAS cannot assist you in recovering the ENCRYPTKEY= key value. The following note is written to the log:
Note: If you lose or forget the ENCRYPTKEY= key value, there will 
be no way to open the file or recover the data.

NO

does not encrypt the data set.

YES

encrypts the data set using the SAS Proprietary algorithm. This encryption method uses passwords that are stored in the data set. At a minimum, you must specify the READ= or the PW= data set option at the same time that you specify ENCRYPT=YES. Because the encryption method uses passwords, you cannot change any password on an encrypted data set without re-creating the data set.

CAUTION:
Record all passwords if you specify ENCRYPT=YES.
If you forget a password, you cannot reset it without assistance from SAS. The process is time-consuming and resource-intensive.

Details

Encryption and compression are mutually exclusive in SPD Engine.
You cannot create an SPD Engine data set with both encryption and compression. If you use ENCRYPT=YES or ENCRYPT=AES and the COMPRESS= data set or LIBNAME option, the following error is generated:
ERROR: The data set was not created because compression and
       encryption cannot both be specified. 
You cannot copy a Base SAS data set that is both compressed and encrypted to an SPD Engine library.
When using ENCRYPT=YES, the following rules apply:
  • To copy an encrypted data set, the output engine must support encryption. Otherwise, the data set is not copied.
  • If the data set is encrypted, all associated index files and metadata files are also encrypted.
  • Encryption requires approximately the same amount of CPU resources as compression.
  • You cannot use PROC CPORT on SAS Proprietary-encrypted data sets.
When using ENCRYPT=AES, the following rules apply:
  • You must use the ENCRYPTKEY= data set option when creating a data set with AES encryption.
  • To copy an AES-encrypted data set, the output engine must support AES encryption. Otherwise, the data set is not copied.
  • If the data set is AES-encrypted, all associated index files are also AES-encrypted.
  • Releases before SAS 9.4 cannot use an AES-encrypted data set.
  • You use SAS/SECURE software, which is included with Base SAS software, to use AES encryption.
You cannot change the ENCRYPTKEY= key value on an AES-encrypted data set without re-creating the data set.

Examples

Example 1: Using ENCRYPT=YES Option

The following example uses the SAS Proprietary algorithm:
libname depta spde 'SAS-library';
data salary(encrypt=yes read=green);
 input name $ yrsal bonuspct;
datalines;
Muriel    34567  3.2
Bjorn     74644  2.5
Freda     38755  4.1
Benny     29855  3.5
Agnetha   70998  4.1
;
To use this data set, specify the Read password:
proc contents data=salary(read=green);
run;

Example 2: Using ENCRYPT=AES Option

The following example uses the AES algorithm:
data salary(encrypt=aes encryptkey=green);
   input name $ yrsal bonuspct;
   datalines;
Muriel    34567  3.2
Bjorn     74644  2.5
Freda     38755  4.1
Benny     29855  3.5
Agnetha   70998  4.1
To use this data set, specify the ENCRYPTKEY= key value:
proc contents data=salary(encryptkey=green);
run;

Example 3: Copying AES-Encrypted Data Sets

The following are two examples of using ENCRYPTKEY= data set options and the COPY procedure:
PROC COPY IN=inlib OUT=outlib ENCRYPTKEY=secret;
    SELECT abc (ENCRYPTKEY=secreta) DEF(ENCRYPTKEY=secretb)…

PROC COPY IN=inlib OUT=outlib;
    SELECT abc (ENCRYPTKEY=secreta) DEF(ENCRYPTKEY=secretb)…