Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: How to create a random number identifier number


From   Anna Reimondos <[email protected]>
To   [email protected]
Subject   st: How to create a random number identifier number
Date   Thu, 12 Nov 2009 13:37:45 +1100

Hello,
I am experiencing problems creating a unique set of number for my dataset.

I have a dataset with around 11,000 subjects or persons, and each one
of these subjects has a unique identifier that is 5 digits long
(personid).
I need to create a concordance file which list the original 5 digit
"personid" and matches this to another new randomly created identifier
for each person. This new identifier (new_personid) also has to be 5
digits long.

Example:
personid   new_personid
10526        35624
18594        21893
54632        12489

I have tried playing around with the gen  x = uniform() function but
to no avail. I am unable to create exactly 11,000 unique numbers with
5 digits.
I also tried just using the egen x=se() command, but then the ids are
sequential and not random and I am afraid then perhaps someone could
figure out how to match the personid and the newperson id....


Any help would be much appreciated,

Thanks
Anna

(Using STATA 10.1, Windows Vista)

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index