Help using Base SAS procedures

assigning unique IDs

Reply
Contributor
Posts: 33

assigning unique IDs

Hi. I have a dataset with about 3,000 records. I need to assign a unique ID to these records but I don't want it to just be 1, 2, 3 or A, B, C. I need it to be something that won't be able to be de-coded. Is there a way to create a list of random numbers or alpha-numerics that I could then add as a variable to my dataset? My dataset has names, dates-of-birth, race and sex.

Thanks so much.
Super Contributor
Super Contributor
Posts: 3,174

Re: assigning unique IDs

Review the SAS DOC and Data Step Language Elements, focusing on the SAS functions for some ideas to use with generating random numer values and look to convert the value to a character string.

Scott Barry
SBBWorks, Inc.
Contributor
Posts: 33

Re: assigning unique IDs

Thanks.
SAS Employee
Posts: 160

Re: assigning unique IDs

data uniqid;
input x y $;
uniqid=md5(cats(x,y));
datalines;
1 A
2 B
3 C
4 D
5 E
;run;
Ask a Question
Discussion stats
  • 3 replies
  • 115 views
  • 0 likes
  • 3 in conversation