Hello,
Below, my data step :
data test;
length c2 $ 64 c1 $ 64;
format c2 $hex64. c1 $hex64.;
c1=sha256('8811421');
c2=sha256('8811531');
run;
I don't understand why c1 is null while c2 is ok.
C2 = 327B1D31BCEC3EAF555B0FB984ABFBC21C564E7D7B4C21D032DE47E62534BB12
Can you help me ?
Thanks,
It might be a display issue, as per:
As can be seen in the response from @andreas_lds to your post, c1 starts with 00, which is also highlighted in the link above.
Try putting the values to the log, rather than viewing the data set and see if that helps, as per the link.
Regards,
Amir.
There must an error in your code, please check the log. When i execute the data-step you posted (two put-statements added), i get:
c1=005CF1E3EAA9EF7AC87EDA95C3EED5752D273FA165519753A37A855D7DBE8B7E c2=327B1D31BCEC3EAF555B0FB984ABFBC21C564E7D7B4C21D032DE47E62534BB12
It might be a display issue, as per:
As can be seen in the response from @andreas_lds to your post, c1 starts with 00, which is also highlighted in the link above.
Try putting the values to the log, rather than viewing the data set and see if that helps, as per the link.
Regards,
Amir.
The full hash value should always be there in the table, this is just a display issue.
Comparisons using program code will compare the full hash values held, not the values displayed.
Regards,
Amir.
@Charlotte37 wrote:
I use the hash key in 2 tables to compare and find differences between the tables.
How to make the join between the 2 tables on the hash key if sometimes she is empty?
Just to underline what @Amir already said: the value is the table, and joining/merging etc. work as intended. Can you show as the code not generating the expected result? If the lengths of the variables you use in sha256 are not the same, you will get different results, even if the shown values are the same - in sas all char-variables are padded with blanks. To avoid this, use
hash = sha256(trim(original));
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!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.