BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lights
Calcite | Level 5

I have been using a macro variable with a comma delimited list of variables i want to sent to md5. so it looks like

 

%let keyvars = %bquote(subjid, lbrefid, lbreqno, lbtestr, lbdat, lbtpt, lbrptid, lbmethod);

 

to make it easier to live with I use a put function in creating the checksum variable.

 

data x;

  set y;

  length checksum $32;

  checksum = put(md5(strip(compress(catx(&labkeys),,'c'))), hex20.);

run;

 

I found it helpful to compress out control characters, forget why at this point

 

I was using this to create a composite key to be used to join or compare datasets, It has proven quite reliable until I discovered just this week that two datasets may have the same variable names, labels and values but if the length is different in any of the variables the checksum values will be different.  That kind of blew things up.  I was looking around today and came on this post about a new SHA256 function available in SAS 9.4 M1.

 

http://blogs.sas.com/content/sasdummy/2014/01/18/sha256-function-sas94/

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 13032 views
  • 8 likes
  • 9 in conversation