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
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 25. Read more here about why you should contribute and what is in it for you!
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.