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

Re: st: Re: Re: RE: matching in Stata


From   "Mark Schaffer" <M.E.Schaffer@hw.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Re: RE: matching in Stata
Date   Thu, 18 Sep 2003 17:03:11 +0100

Michael,

From:           	"Michael Blasnik" <michael.blasnik@verizon.net>
To:             	<statalist@hsphsun2.harvard.edu>
Subject:        	st: Re: Re: RE: matching in Stata
Date sent:      	Thu, 18 Sep 2003 11:54:04 -0400
Send reply to:  	statalist@hsphsun2.harvard.edu

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

I'd like to put in a vote for an SSC posting - I've had occasion in 
the past to do this kind of merge, and I know colleagues who have 
faced similar problems and who would find this program helpful.  We'd 
all be deeply indebted if you did....

--Mark

> 
> Michael Blasnik
> michael.blasnik@verizon.net
> 
> ----- Original Message ----- 
> From: "Oleksandr Shepotylo" <shepotil@econ.umd.edu>
> To: <statalist@hsphsun2.harvard.edu>
> 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" <Hsieh@olin.wustl.edu>
> > To: <statalist@hsphsun2.harvard.edu>
> > 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: owner-statalist@hsphsun2.harvard.edu on behalf of Oleksandr
> > Shepotylo
> > > Sent: Wed 9/17/2003 10:01 AM
> > > To: statalist@hsphsun2.harvard.edu
> > > 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/


Prof. Mark E. Schaffer
Director
Centre for Economic Reform and Transformation
Department of Economics
School of Management & Languages
Heriot-Watt University, Edinburgh EH14 4AS  UK
44-131-451-3494 direct
44-131-451-3008 fax
44-131-451-3485 CERT administrator
http://www.som.hw.ac.uk/cert
*
*   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–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index