Re: Height and Weight Files [message #3310 is a reply to message #3282] |
Wed, 19 November 2014 23:00 |
Trevor-DHS
Messages: 805 Registered: January 2013
|
Senior Member |
|
|
First, I think you are using the wrong files here. The files for Armenia 2005 are AMKR54FL.dat and AMHW52FL.dta, not AMKR42FL.dat and AMHW01FL.dta.
Second, though, later DHS surveys collected the anthropometry data for all children living in the household, as part of the household questionnaire, rather than just children of interviewed women. For that reason the dataset includes hwhhid which is the ID of the household questionnaire. These datasets are principally designed to link with the PR datasets, and analyses in the survey reports are produced from the data in the PR files, not the KR files for these surveys.
If you want to link to the KR files and just use the data for children of interviewed women, then the following is the approach to use:
use "AMKR54FL.dta"
* Create the household ID by dropping the 3 d character line number from caseid
gen hwhhid = substr(caseid,1,length(caseid)-3)
* Make a copy of the household line number (could use rename instead)
clonevar hwline = b16
* Sort on the household ID and the line number from the household schedule
sort hwhhid hwline
* Merge the data
merge m:1 hwhhid hwline using "AMHW52FL.dta"
Note that this uses a many to one merge because b16 can be 0 (if child is not a member of the household) or b16 can be missing (if the child is dead), and more than one child in the household can have these codes. A 1:1 merge will fail because of potential duplicate values of 0 or missing. Alternatively drop if hwline == 0 or hwline == . to avoid the risk of duplicates and then use 1:1 merge.
The following link is also useful for general information on merging datasets: http://www.dhsprogram.com/data/Merging-Datasets.cfm
|
|
|