ENCRYPTKEY= Data Set Option

specifies a key value for AES (Advanced Encryption Standard) encryption.

Note: You cannot change the key value on an AES-encrypted data set without re-creating the data set.

Syntax

ENCRYPTKEY=key-value

Details

Specifies to assign an encryption key value. You must specify the ENCRYPTKEY= data set option when you are using ENCRYPT=AES. The key value can be up to 64 bytes long. To create an ENCRYPTKEY= key value with or without quotation marks, follow these rules:

No quotation marks:

  • use alphanumeric characters and underscores only
  • can be up to 64 bytes long
  • use uppercase and lowercase letters
  • must start with a letter
  • cannot include blank spaces
  • is not case sensitive

%let mykey=abcdefghi12;
encryptkey=&mykey
encryptkey=key_value
encryptkey=key_value1

Single quotation marks:

  • use alphanumeric, special, and DBCS characters
  • can be up to 64 bytes long
  • use uppercase and lowercase letters
  • can include blank spaces, but cannot contain all blanks
  • is case sensitive

encryptkey='key_value'
encryptkey='1234*#mykey'

Double quotation marks:

  • use alphanumeric, special, and DBCS characters
  • can be up to 64 bytes long
  • use uppercase and lowercase letters
  • can include blank spaces, but cannot contain all blanks
  • is case sensitive

encryptkey="key_value"
encryptkey="1234*#mykey"
%let mykey=Abcdefghi12;
encryptkey="&mykey"
When the ENCRYPTKEY= key value uses DBCS characters, the 64-byte limit applies to the character string after it has been transcoded to UTF-8 encoding. You can use the following DATA step to calculate the length in bytes of a key value in DBCS:
data _null_;
    key=length(unicodec('key-value','UTF8'));
    put 'key length=' key;
run;