Thanks to both of you for the comments and apologies for the initial ambiguities. I don't typically interact with this type of variable structure so my language may have been incorrect. The HEX variable is generated using the MD5 function and the output is assigned the $hex32 format to make it readable. So I believe I was incorrect in my initial post. The underlying data is whatever the default output of the MD5 function is and I have applied the $hex32 format myself. My issue is that when I try to then truncate or combine the HEX variable with normal char or num variables the result is gibberish. My goal is to combine a 2-digit year, a 2-digit state code, and the first 6 digits of the HEX variable into a new combined ID. See below for what currently happens when I run the following code: data test; length hex $32.; format hex $hex32.; set book1;
hex = md5(cats(year,state,id));
newid = cats(state,mod(year,100),substr(hex,6));
run; hex Year State ID newid 0FC31C920C2957877533B187C24FDB1D 2019 GA 123456 GA19)W‡u3±‡ÂOÛ My actual goal is for the newid variable in this case to be GA190FC31C with a standard $char10 format. Does that make more sense? I'm having a tough time putting it into words. Thanks for the help.
... View more