Hi all,
I have a question on how to generate a family ID for individuals that are siblings. Please find the hypothetical data below.
As you can see that 1000 and 1001 are siblings, so I want to create a family ID that is the same for these two individuals. Same for 1002,1003, and 1004 etc.
I tried to just add PID and SibID together, but this doesn't work as PID of 991 with SibID1 of 1010 would have the same value as PID 1000 with SibID1 of 1001, tho they don't belong to the same family.
I am sure there are smart ways to do it, but I just can't think of one right now.
Thank you so much for your help,
Alex
I have a question on how to generate a family ID for individuals that are siblings. Please find the hypothetical data below.
As you can see that 1000 and 1001 are siblings, so I want to create a family ID that is the same for these two individuals. Same for 1002,1003, and 1004 etc.
PID | SibID1 | SibID2 | SibID3 | SibID4 | famID |
991 | 1010 | ||||
1000 | 1001 | ||||
1001 | 1000 | ||||
1002 | 1003 | 1004 | |||
1003 | 1004 | 1002 | |||
1004 | 1003 | 1002 | |||
1005 | 1006 | 1007 | 1008 | 1009 | |
1006 | 1007 | 1008 | 1009 | 1005 | |
1007 | 1008 | 1009 | 1005 | 1006 | |
1008 | 1009 | 1007 | 1006 | 1005 | |
1010 | 991 |
I am sure there are smart ways to do it, but I just can't think of one right now.
Thank you so much for your help,
Alex
Comment