dear, I hope you are very well, how can I create a unique id and that is a combination of the entire row of a database?
How many variables and of what types are they? Are any of the variables dates or times and do you need to see the date in that variable? Do any of the numeric variables have decimal portions and if so, how much to want to see?
How many variables have missing values? How should the missing values appear in the result?
You can try something like:
data want; set have; length uniqueid $ 500; /*<= this number needs to be large enough to represent the maximum number of characters that might result*/ uniqueid = cats(of _all_); run;
Though I won't be surprised if you don't like the result.
Hi Andres,
This macro can be used to take a hash of all the values. It will work with high precision decimals, special missings, and very wide character variables.
It's the same algorithm we use to diff uploads in Data Controller for SAS. The ID will have a length of $32.
https://core.sasjs.io/mp__md5_8sas.html
Best,
Allan
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.