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

st: RE: matching data


From   "Nick Winter" <[email protected]>
To   <[email protected]>
Subject   st: RE: matching data
Date   Tue, 8 Apr 2003 10:14:48 -0400

Why does -merge- not work for you?  I would think:

	. use <<dataset2>>
	. sort N1 N2 N3
	. save, replace
	. use <<dataset1>>
	. sort N1 N2 N3
	. merge N1 N2 N3 using <<dataset2>> , nokeep
	. generate check=(_merge==3)

(The last line simply creates the check variable, based on whether or
not there was a successful merge.)

Nick WInter


-----------------------------------------------------------
 Nicholas Winter, Ph.D.                     P 202.939.5343
 Policy Studies Associates                  F 202.939.5732
 1718 Connecticut Avenue, NW     [email protected]
 Washington, DC 20009-1148           www.policystudies.com
----------------------------------------------------------- 

> -----Original Message-----
> From: Reka Sundaram-Stukel [mailto:[email protected]] 
> Sent: Tuesday, April 08, 2003 10:11 AM
> To: [email protected]
> Subject: st: matching data
> 
> 
> Dear Statalist,
> 
> I am interested in matching names in two datasets. For example,
> 
> each household head has:
> 
> N1			N2			N3
> First name 	Second name 	Middle name
> 
> I need to create a variable that does the following
> 
> gen check=0
> 
> if 'N1' in 'data set A' == 'N1' in 'dataset B'
> and if  'N2' in 'data set A' == 'N2' in 'dataset B'
> and if 'N3' in 'data set A' == 'N3' in 'dataset B'
> 
> replace gen check=1
> 
> I have tried merge by matching but I don't think that works. I think 
> what I need is a command like VLOOKUP (excel) in stata.
> 
> any suggestions?
> 
> 
> 
> Reka Sundaram-Stukel
> Agriculture And Applied Economics
> 320 Taylor Hall
> 
> *
> *   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/
> 

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