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: identify family members using -egen (group)


From   Amanda Fu <mandy.fu1@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: identify family members using -egen (group)
Date   Thu, 10 Nov 2011 22:33:49 -0500

Hi All,

I know there are discussions on how to identify siblings before on
statalist. The solutions are using the same mother and fathor's ID.
But I still have not figured out  how to identify family members in my
data set, since there are no parents' ID.

The data set looks like as follows:
---------------------------------------
id       fam_member1_id    fam_member2_id   fam_member3_id

1            missing                   missing
missing
2            3                             missing                     missing
3            2                             missing                     missing
4            5                              6
    missing
5            4                              6
    missing
6            4                              5
    missing
............
----------------------------------
That is, ID 2 and 3; 4,5, and 6 are in the same families.
I tried to use
. egen famid =group(id  fam_member1_id    fam_member2_id
fam_member3_id),missing
but the famid I got is not the same for a family.
----------------------------------the last column is what I want to get-----
id       fam_member1_id    fam_member2_id   fam_member3_id     famid

1             missing                  missing
missing            missing
2            3                             missing
missing              1
3            2                             missing
missing              1
4            5                              6
    missing              2
5            4                              6
    missing              2
6            4                              5
    missing              2
............
----------------------------------
Any suggestion will be helpful. Thanks!
Best,
Amanda
*
*   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