Hi there,
somebody hashed account number using the SQL code: 'SHA2_256' . Is there a SAS equivalent function to give the same hashed account? I used SHA256 but no luck yet.
Your help will be highly appreciated.
many thanks,
As I understand it, SAS uses the "global" available algorithm. So it shouldn't be any difference.
How did you verify that didn't have any luck?
Perhaps it's the data that changed between the environments. Transcoding/truncation of trailing blanks etc can occur.
The output of the SHA256 function in SAS is the raw bytes. I assume you want the hash string. In which case you just want to combine the SHA256 function call with a PUT function and the $hex64. format. Without specifying what SQL implementation you are referring to, I can only speculate what you are really looking for.
data foo;
set sashelp.class;
hash_name=put(sha256(name),$hex64.);
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.