| Home | ESDS | A-Z index | Site map | Contact | Login | Search: 
ESDS Government logo - link to ESDS Government home page

ESDS Government


merge

Notes from the GHS

Question

I am trying to merge some individual (person) files using GHS data. For instance, suppose I merge different person files using the 1983 wave. The merging procedure is as follows:

sort persno (person number in the household)
use c:\person83.dta (master data)
merge persno using c:\indivdl83.dta (where indivdl83 is the using data and persno has been sorted before the indivdl83.dta data file is saved).

The merging of the two datasets is successful but Stata reports the following errors: "variable persno does not uniquely identify observations in the master data" and "variable persno does not uniquely identify observations in the using data". I was wondering if you have an answer to this problem.

Answer

You need to uniquely identify an individual to do a 1 to 1 merge. As all people who are person 1 in thier household will share a common person no. (as will all person 2s etc) you'll also need to specify which household they are in. Sort both datasets by hserno as well as persno then use merge hserno persno using <other file>, unique and that should do the trick.



ESDS Home Page > Government > Ghs > Notes
_
  Page last updated 23 April 2012
© Copyright 2003 - 2012 Universities of Essex and Manchester. All rights reserved.
Contact   |    Copyright and Disclaimer    |    Accessibility |   Send us comments on this page
Link to University of Essex Link to University of Manchester Link to JISC Link to ESRC