Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: How to merge those files


From   "Yu,Jingbo" <[email protected]>
To   [email protected]
Subject   st: How to merge those files
Date   Wed, 17 Oct 2007 18:23:18 -0400

Hi, I got stuck and cannot find out what's wrong with my commands.
Anybody can help me check on them? Thanks!

 

Jingbo

___________________________________

 

Child data file:

DUID (family ID, 5 digits)

PID (person ID within family, 3 digits)

DUPERSID (unique person, 8 digits) *DUPERSID=DUID+PID

MOPID (mom PID)

DAPID (dad PID)

 

Parents data file:

DUID

PID

DUPERSID

 

I am trying to link the two files together with those commands:

 

use parents, clear

generate duidpid=dupersid

sort duidpid

save parents, replace

 

use child, clear

generate duidpid=(duid*1000)+mopid

sort duidpid

merge duidpid using "child"

tab _merge

 

. tab _merge

 

     _merge |      Freq.     Percent        Cum.

------------+-----------------------------------

          1 |     16,956       33.01       33.01

          2 |     34,403       66.99      100.00

------------+-----------------------------------

      Total |     51,359      100.00

 


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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