ENCRYPT= Table Option

Specifies whether to encrypt an output SAS data set or SPD Engine data set.

Category: Table Control
Restrictions: Use with output tables only.
In SPD Engine data sets, cannot be used with COMPRESS=YES | CHAR | BINARY.
Data source: SAS data set, SPD Engine data set

Syntax

ENCRYPT= AES | NO | YES

Arguments

AES

encrypts the file using AES (Advanced Encryption Standard) algorithm. AES provides enhanced encryption by using SAS/SECURE software. SAS/SECURE is a product within the SAS System. Beginning with SAS 9.4, SAS/SECURE is included with Base SAS software. Before SAS 9.4, SAS/SECURE was an add-on product that was licensed separately. This change makes strong encryption available in all deployments (except where prohibited by import restrictions). You must specify the ENCRYPTKEY= table option when using ENCRYPT=AES. For more information, see ENCRYPTKEY= Table Option.

Requirement SAS/SECURE software must be in use.
CAUTION:
Record all ENCRYPTKEY= values when using ENCRYPT=AES.
If you forget the ENCRYPTKEY= value, you lose your data. SAS cannot assist you in recovering the ENCRYPTKEY= value. The following note is written to the log:
Note: If you lose or forget the ENCRYPTKEY= 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 SASProprietary algorithm. This encryption method uses passwords that are stored in the data set. At a minimum, you must specify the READ= or the PW= table option at the same time that you specify ENCRYPT=YES. Because the encryption method uses passwords, you cannot change any password on an encrypted file without re-creating the table.

CAUTION:
Record all passwords when using ENCRYPT=YES.
If you forget the passwords, you cannot reset them.

Details

In SPD Engine data sets, encryption and compression are mutually exclusive. You cannot specify encryption for a compressed SPD Engine data set. You cannot compress an encrypted SPD Engine data set.
When using ENCRYPT=YES, the following rules apply:
  • You can use the ENCRYPT= option only when you are creating a table.
  • In order to copy an encrypted data file, make sure that the output engine supports encryption. Otherwise, the data file is not copied.
  • Encrypted files work only in SAS 6.11 or later.
  • If the data file is encrypted, all associated indexes are also encrypted.
  • Encryption requires approximately the same amount of CPU resources as compression.
  • You cannot use PROC CPORT on SASProprietary encrypted data files.
When using ENCRYPT=AES, the following rules apply:
  • You must use the ENCRYPTKEY= table option when creating a table.
  • To copy an encrypted AES data file, the output engine must support AES encryption. Otherwise, the data file is not copied.
  • Beginning with SAS 9.4, you can use an encrypted AES data file.
  • You must have SAS/SECURE software to use AES encryption.
  • You cannot change the ENCRYPTKEY= value on an AES encrypted data file without re-creating the data file.

Example: Using the ENCRYPT=YES Option

This example creates an encrypted data set using the SASProprietary algorithm:
create table myfiles.salary {option encrypt=yes read=green}
   (name char(15),
    yrsal double,
    bonuspct double);
insert into myfiles.salary {option read=green} values ('Muriel', 34567, 3.2);
insert into myfiles.salary {option read=green} values ('Bjorn', 74644, 2.5);
insert into myfiles.salary {option read=green} values ('Freda', 38755, 4.1);
insert into myfiles.salary {option read=green} values ('Benny', 29855, 3.5);
insert into myfiles.salary {option read=green} values ('Agnetha', 70998, 4.1);
To retrieve data from the data set, you must specify the Read password:
select * from myfiles.salary {option read=green};

See Also

Table Options:
Last updated: February 23, 2017