Statalist


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

Re: st: How to merge those files


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: How to merge those files
Date   Thu, 18 Oct 2007 10:34:18 -0400

Jingbo --
Look at your matching variables to see why they do not correspond
across the datasets.  Are they the advertised length?  Are they all
numeric?  Etc.
use parents, clear
codebook dupersid
use child, clear
codebook duid mopid

On 10/18/07, E. Paul Wileyto <[email protected]> wrote:
> Your code is written like SAS programming.  Try the "joinby" command.
> It does not require a preliminary sort.
>
> Yu,Jingbo wrote:
> > Hi, I got stuck and cannot find out what's wrong with my commands.
> > Anybody can help me check on them? Thanks!
> > 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
> >      _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