Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Requirement(s) for a match merge


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: Requirement(s) for a match merge
Date   Wed, 30 Mar 2005 18:46:22 +0100

I see what you are getting at. 

-father- is irrelevant to the -merge-. You 
can merge on -id- without problems with this 
example. 

Nick 
n.j.cox@durham.ac.uk 

louis boakye-yiadom
 
> Perhaps an example will clarify my concern. Suppose we have 
> the following 
> datasets, where -id- (the identifier) represents family code:
> Dataset1
>       id   father
> 1.   1    John
> 2.   2    Peter
> 3.   3    Sam
> 
> Dataset2
>      id  child
> 1.  1   Bill
> 2.  2   Joe
> 3.  2   Mary
> 4.  3   Phil
> 5.  3   Sue
> 6.  3   Pat
> 
> I was thinking that even though -id- does not uniquely identify each 
> observation in dataset 2, the datasets can still be merged 
> using -id- as the 
> match variable to obtain a result like the following:
> 
>      id   father child
> 1.  1    John   Bill
> 2.  2    Peter  Joe
> 3.  2    Peter  Mary
> 4.  3    Sam    Phil
> 5.  3    Sam    Sue
> 6.  3    Sam    Pat
> 
> Or is it that this kind of merge is not called match merge? Thanks.
 
"Nick Cox" <n.j.cox@durham.ac.uk>

> >Let's turn this round. If this is not true,
> >how do you expect match merge to work?

louis boakye-yiadom

> > > Is it true that "for a match merge to work, the identifier or
> > > identifiers
> > > must uniquely identify each observation"? I found this
> > > statement in sample
> > > lecture NC 101 (one of StataCorp's NetCourses), but I thought
> > > that this
> > > requirement (of the id uniquely identifying each observation)
> > > is often
> > > desirable, but not necessary in all cases. Any insights will
> > > be appreciated.

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index