BookmarkSubscribeRSS Feed
nickspencer
Obsidian | Level 7
Hello,
I have a SAS data with character column ID that is 20 character in length. But the values are all numbers. I want to encrypt the column ID with symbols, alphabets and numbers. What will be the best way to encrypt the column and be able to decrypt later?
Any suggestion or sample code is appreciated.
1 REPLY 1
SASKiwi
PROC Star

Why do you need to decrypt later when you have the original unencrypted version? One method I use hashes the field using the SAS MD5 function:

Account_Key = put(md5(cats('ID',Account_Number)),$hex10.);

This type of encryption is one-way though - there is no easy way to decrypt it. By maintaining a list of both the original and encrypted versions there is no need for decryption. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 1578 views
  • 0 likes
  • 2 in conversation