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: AW: pair data to individual data


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: pair data to individual data
Date   Thu, 10 Jun 2010 14:44:10 +0200

<> 

W/o the duplicates in "famid", this could be an easy -reshape- problem:


*************
clear*

input int famid long(aid_1 aid_2)
1001 93710875   97570477 
1002 93576557   97506154 
1003 96717912   96717917 
1004 91656927   97676522 
1005 91588998   93578896 
1006 90718946   91588942 
1007 99578364   99578369 
1008 91576326   98576229 
1009 93506890   93506897 
1010 92544209   96884901 
1011 93504422   99574220 
1012 90571316   91571911 
1013 91576322   91576325 
1014 90716062   91886961 
1015 91540352   91540358 
1016 94718146   98578449 
1017 97575250   97575258 
1018 91885961   94575866 
end

list, noo

reshape long aid_, i(famid) j(j)
ren aid_ aid
l, sepby(famid) noo
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Averett, Susan L
Gesendet: Donnerstag, 10. Juni 2010 14:26
An: statalist@hsphsun2.harvard.edu
Betreff: st: pair data to individual data


I have a data set that has a family id (famid) and two individual person identifiers for siblings (aid_1 and aid_2) plus some other variables which are not shown. As you can see below the famid column has a family with id 1001 with two siblings, 93710875   97570477. Some families, such as 1011 have more than two sets of siblings. See below:

     +-----------------------------+
     | famid      aid_1      aid_2 |
     |-----------------------------|
  1. |  1001   93710875   97570477 |
  2. |  1002   93576557   97506154 |
  3. |  1003   96717912   96717917 |
  4. |  1004   91656927   97676522 |
  5. |  1005   91588998   93578896 |
     |-----------------------------|
  6. |  1006   90718946   91588942 |
  7. |  1007   99578364   99578369 |
  8. |  1008   91576326   98576229 |
  9. |  1009   93506890   93506897 |
 10. |  1010   92544209   96884901 |
     |-----------------------------|
 11. |  1011   93504422   99574220 |
 12. |  1011   93504422   99574221 |
 13. |  1011   99574220   99574221 |
 14. |  1012   90571316   91571911 |
 15. |  1013   91576322   91576325 |
     |-----------------------------|
 16. |  1014   90716062   91886961 |
 17. |  1015   91540352   91540358 |
 18. |  1016   94718146   98578449 |
 19. |  1017   97575250   97575258 |
 20. |  1018   91885961   94575866 |
     +-----------------------------+

Somehow I need to make this look like:

famid      aid
1001     93710875  
1001     97570477

etc...

Any ideas? I've been messing with this for awhile but to no avail.
Thanks!

Susan Averett
*
*   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/


*
*   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