Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: Fwd: Mergeing datasets


From   Thomas Speidel <thomas@tmbx.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Fwd: Mergeing datasets
Date   Tue, 26 Apr 2011 18:32:59 -0600

-------- Original Message --------
Subject: Mergeing datasets
Date: Tue, 26 Apr 2011 16:17:47 -0600
From: Thomas Speidel <thomas@tmbx.com>
To: <statalist@hsphsun2.harvard.edu>
Reply-To: thomas@tmbx.com

I have a dataset containing mappings of various id's used in a study. The truly unique person identifier is the variable master. A person may then be assigned an id:

    master   id1   id2   id3   id4
       106   708   673     .   676
       110   713   696     .   704
       122   721   721     .     .
       123   749   722     .   728
       129   789   789   734     .
       134   739   739     .     .
       144   800   752     .   763
       145   808   753     .   780
       151   797   764     .   781
       158   811   771     .   779

I have a working dataset containg id. The id may come from id1, id2, id3, or id4 above:

. list id in 1/10, clean noobs

      id
    2014
    2030
    2038
    2041
    2042
    2054
    2055
    2058
    2061
    2065

I need to merge(?) the two so that I can get the master id for each id, regardless of whether they came from id1 id2 id3 id4. I thought this was a job for merge, but did not find a mention for this type of situations in the manual. I suppose I could do four sequential merges. Any suggestion on how to best proceed?
Thanks.

--
Thomas Speidel

--
Thomas Speidel
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index