Have you ever assigned a universal unique identification (UUID) to a data set in SAS 9.4 or SAS EG? We need to prep our datasets for SQL database and we need to make sure each observation from one data set share the same UUID that is different from all other datasets.
What you describe sounds like you want UUID per observation.
If you mean to add an identifier then you may be looking for the UUIDGEN function. The example data set creates a 32 character id using the function. If you don't assign a length for the variable it will default to 200 characters.
data example; length id $ 32; do i=1 to 10; id = uuidgen(); output; end; run;
If you want the same value for all records in a data set you would use something like
data want; set have; length id $ 32; retain id; if _n_=1 then id = uuidgen(); run;
Or generate a single value one record data set and use a join in Proc SQL to add the value to all the records.
Thank you so much, this worked really well 🙂
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: