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/

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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
  • 13573 views
  • 8 likes
  • 9 in conversation