Statalist The Stata Listserver


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

RE: st: RE: Merge??


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Merge??
Date   Wed, 14 Feb 2007 17:56:48 -0000

What you call it we can defer. 

Austin's key point remains: how do 
you expect Stata to know what you evidently know about which observations 
should or should not be matched?

I don't see that your example specifies anything
to differentiate the two observations with "82 1" so that 
Stata should treat them differently. Even if it's arbitrary you still need
another variable to specify a match, I believe. 

Nick 
[email protected] 

Raphael Fraser
 
> Did not mistype. That is exactly what I want. That is why merge has a
> question sign in the subject line (Merge??). At first glance it looks
> like a merge solution but its probably not.
> 
> On 2/14/07, Austin Nichols <[email protected]> wrote:
> > Maarten--
> > That would have been my first thought, too.  But Raphael Fraser has
> > either mistyped his desired outcome, or has some hidden structure in
> > mind that matches d1 and d2 in the first obs in 82 and not 
> the second:
> >  82    1   1
> >  82     .   1
> > If he meant
> >  82    1   .
> >  82     .   1
> >  82     .   1
> > then he wants to -append- not -merge- I guess.  If he did 
> not mistype,
> > he still may want to -append- and then -replace- according to some
> > rule...
> >
> > On 2/14/07, Maarten Buis <[email protected]> wrote:
> > > --- Raphael Fraser wrote:
> > > I would like to merge data1 and data2:
> > >
> > > data1,
> > > time d1
> > > 82    1
> > > 90    0
> > >
> > > data2,
> > > time d2
> > > 82    1
> > > 82    1
> > > 89    0
> > >
> > > The result should look like this
> > > time d1 d2
> > > 82    1   1
> > > 82     .   1
> > > 89     .   0
> > > 90    0    .
> > >
> > >
> > > You need to make sure that both data1 and data2 are sorted
> > > according to time. Then you can use -merge-, see:
> > > -help merge-. The do-file will look something like this:
> > >
> > > use data2, clear
> > > sort time
> > > save data2, replace
> > > use data1, clear
> > > sort time
> > > merge time using data2
> > > list time d1 d2 _merge in 1/20
> > > tab _merge
> > >
> > > Hope this helps,
> > > Maarten
> > >
> > > BTW you have reached the same answer if you searched in Stata
> > > on merge, by typing -findit merge-.

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