BookmarkSubscribeRSS Feed
SAS_LuisBolivar
Quartz | Level 8

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.

7 REPLIES 7
mkeintz
PROC Star

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.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
SASKiwi
PROC Star

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.

SAS_LuisBolivar
Quartz | Level 8

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.

ChrisNZ
Tourmaline | Level 20

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,

japelin
Rhodochrosite | Level 12

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.

Kurt_Bremser
Super User

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.

japelin
Rhodochrosite | Level 12

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1721 views
  • 2 likes
  • 6 in conversation