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

st: Re: Re: RE: matching in Stata


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: Re: RE: matching in Stata
Date   Thu, 18 Sep 2003 11:54:04 -0400

I have written an ado (nearmrg.ado) that I think directly addresses this
problem.  It allows specifying a list of variables that must match exactly
between the datasets (gender and region in your dataset?) and requires you
to specify one variable that is matched to the "closest" value in the using
file.  The closest value may be defined in a few ways, including some ways
that allows the use of string variables.  I can email the files to you
directly if you are interested.  I may post it to SSC if there is general
interest.

Michael Blasnik
[email protected]

----- Original Message ----- 
From: "Oleksandr Shepotylo" <[email protected]>
To: <[email protected]>
Sent: Wednesday, September 17, 2003 12:21 PM
Subject: st: Re: RE: matching in Stata


> Dear Chih-Mao,
>
> -merge is not good because even though two samples are form the same
> population they have different observations and can not be matched
> perfectly.
>
> My problem can be demostrated with the following example:
>
> Dataset1:
> person   age  gender  region income
> 1             20    M        MD     10,000
> 2             45     F         CA     100,000
>
> Dataset 2:
>
> person     age  gender  region   income
> 1              23    F         DC            ?
> 2              35    M        TX            ?
>
> I need program that will match people based on age gender region
> and will set income in dataset2 based on closest match from 1.
>
> Oleksandr.
>
> ----- Original Message -----
> From: "Chih-Mao Hsieh" <[email protected]>
> To: <[email protected]>
> Sent: Wednesday, September 17, 2003 11:56 AM
> Subject: st: RE: matching in Stata
>
> > Dear Oleksandr
> >
> > I would imagine that -merge- is what you're looking for, maybe with a
> couple -gen- commands along the way.  What is ultimately done will depend
on
> what you intend to do with all the "extra" observations in X2 (whether you
> still want to match those, or you have a rule to leave some unmatched).
> >
> > Chihmao.
> >
> > -----Original Message-----
> > From: [email protected] on behalf of Oleksandr
> Shepotylo
> > Sent: Wed 9/17/2003 10:01 AM
> > To: [email protected]
> > Cc:
> > Subject: st: matching in Stata
> >
> > Dear Statalist,
> >
> >   Is there any Stata procedure that will match observations from 2
different
> > datasets drawn from the same population.
> >   Let's say, I have  datasets X1=(x,y) and X2=(x). I want to construct
> > X2*=(x*,y) based on mathching observations with closest x's. Also, since
> X2 has more observations correspondence should not be  1 to 1.
> >
> > Thanks,
> >
> > Oleksandr.



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