Good afternoon community.
I need your expert support, I need to generate a file in encrypted SAS, it would help me a lot if you can share an example or a link where I can find an example.
Thanks.
If you go to Lex Jansen's Website of SAS (regional and global) conference papers, and search for "encrypt", a number of papers shows up. The latest is a SESUG 2020 paper, Data Security in SAS® using Encryption and Hashing, by Rajasekar Sundaram Start with that.
Your question isn't clear. What type of files do you want to encrypt? SAS datasets, SAS programs or something else? Or do you want to encrypt variables within SAS datasets?
If you want to encrypt at the file level then you would be better off using specialist tools like 7-Zip, PGP etc. If you want to encrypt actual variables in SAS datasets then you need to explain your requirements.
Hi.
At the file level and at the variable level.
Design an example with the sas help data sets.
data Encrypt_team;
set SASHELP.BASEBALL (keep=Team);
Encrypt_team=MD5(team);
format Encrypt_team $hex64.;
run;
I think that with that I can resolve the requirement at the variable level.
Thanks.
At the data set level, use option encrypt=
At the variable level, use function SHA256 (and possibly format hex.). MD5 is now considered weak and obsolete,
The MD5 function is a hash generator, not an encryptor!
Simply put, there is a difference between hashing,
which is for uniqueness and is non-reversible, and
encryption, which is for confidentiality and is reversible.
Hashing isn't unique. Since the hashes have a finite length for any source length, you can find an infinite number of source values creating the same hash.
If you need is encrypted SAS dataset, try this code.
Open these datasets in a text editor such as notepad or a binary editor.
/* not encrypted dataset */
data noenc;
a='123456789';
run;
/* middle secure encrypted dataset:SAS8 */
data enc1(encrypt=yes pw=password);
a='123456789';
run;
/* high secure encrypted dataset:SAS9.4 */
data enc2(encrypt=aes encryptkey=key);
a='123456789';
run;
/* extreme secure encrypted dataset:SAS9.4m5~ */
data enc3(encrypt=aes2 encryptkey=key);
a='123456789';
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.