Re: Merging Mali 2001 HW to KR [message #30532 is a reply to message #30522] |
Mon, 16 December 2024 08:38 |
Bridgette-DHS
Messages: 3214 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS staff member, Tom Pullum:
To merge a KR and HW file, you first drop from the KR file any children for whom b16 is 0 or a dot (NA). These are children who are living elsewhere or have died. You also have to extract the household id code from the woman's id code. In the Mali 2001 survey, the household id code is a 12-character string, and is the first 12 characters of the woman's id code (caseid) which is a 15-character string.
The following lines will do this for the Mali 2001 survey.
use "...MLKR41FL.DTA", clear
drop if b16==. | b16==0
gen hwhhid=substr(caseid,1,12)
gen hwline=b16
merge 1:1 hwhhid hwline using "...MLHW41FL.DTA"
You then get the distribution of _merge as follows:
. tab _merge
_merge | Freq. Percent Cum.
------------------------+-----------------------------------
master only (1) | 5 0.04 0.04
using only (2) | 1,554 12.70 12.74
matched (3) | 10,682 87.26 100.00
------------------------+-----------------------------------
Total | 12,241 100.00
The 5 cases with _merge=1 are in the KR file but not the HW file. The 1,554 children with _merge=2 are in the HW file but not the KR file, and the 10,682 children with _merge=3 are in both files. If your goal is to add the anthropometry variables to the KR file, and then continue to analyze all the cases in the original KR file, you would drop the cases with _merge=2 and then drop _merge. You may want to add back in the children for whom b16 is 0 or a dot, who were dropped before the merge, depending on what other KR variables you are working with.
Please try something similar for the Senegal survey.
|
|
|