I am running a code in hadoop using PROC SQL passthrough in SAS. I have a number to hash to use in hadoop/hive. My SAS code is not working. Could someone help me write this in hadoop sql?
I need a code in hadoop sql syntax equivalent to put(sha256(strip(number)||"d8pyrtuc0q"),$hex64.) ?
example of SAS code:
data one;
input number $10. ;
hash_number=put(sha256(strip(number)||"d8pyrtuc0q"),$hex64.);
cards;
123456789
9876543210
;
run;
The result looks like this
NUMBER HASH_NUMBER
123456789 F35721F6CC13511F1BC0DE3D0B91287F4C41BF110026707BFEBC671EA32308F7
9876543210 6EAA2E945E25C109563FA1A533E9EC9710C34339710F6A463E2AD30BC528F7BC
Thanks in advance
The sha256 value occupies 64 bytes in hex format. So whatever you add after is dropped off since you restrict the length to 64.
Like this?
hash_number=put(sha256(strip(number),$hex64.))||"d8pyrtuc0q";
As for native HQL, why don't you look up the HQL functions?
Here, you need function sha2() and hex().
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: