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 6EAA2E945E25C109563FA1A533E9EC9710C34339710F6A463E2AD30BC528F7BCThanks 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().
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.