Merging data [message #10190] |
Thu, 07 July 2016 06:18 |
Lukresha
Messages: 14 Registered: July 2016
|
Member |
|
|
I am working with data from KDHS and most of the variables I would like to use are in the PR file and MR file. I have seen that a previous question was already asked on the forum but I would like to know whether there is a way I can merge the data such that I do not lose part of my age(hv105)values.
Using advice from the previous posts, this is how I carried out my merging:
use "\\smbhome.uscs.susx.ac.uk\ln201\Desktop\KDHS\KEMR70FL.DTA", clear
rename mv001 hv001
rename mv002 hv002
rename mv003 hvidx
save "\\smbhome.uscs.susx.ac.uk\ln201\Desktop\KDHS\KEMR70FL.DTA", replace
file \\smbhome.uscs.susx.ac.uk\ln201\Desktop\KDHS\KEMR70FL.DTA saved
use "\\smbhome.uscs.susx.ac.uk\ln201\Desktop\KDHS\KEPR70FL.DTA", clear
sort hv001 hv002 hvidx
merge hv001 hv002 hvidx using MRtemp.dta
tab _merge
_merge | Freq. Percent Cum.
------------+-----------------------------------
1 | 141,021 91.67 91.67
3 | 12,819 8.33 100.00
------------+-----------------------------------
Total | 153,840 100.00
The output I get on age of household members before using keep if _merge==3 is:
sum hv105
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------- -----------
hv105 | 153,822 22.67255 19.12394 0 95
But after keep if _merge==3 is:
sum hv105
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------- -----------
hv105 | 12,819 30.07645 10.90915 15 54
I am kindly inquiring if there is a way I can merge such that hv105 will have values beginning from 0-15 as that's the desired age group I would like to focus on.
Thank you.
|
|
|
|
|
Re: Merging data [message #10198 is a reply to message #10192] |
Thu, 07 July 2016 12:19 |
Bridgette-DHS
Messages: 3214 Registered: February 2013
|
Senior Member |
|
|
Another response from Tom Pullum:
The variables you name (m714, m717, mv732) are only available in the MR file, which includes for men 15-54. Similarly, v714, v717, v732 are only available in the IR file, which includes women 15-49. They are not in the PR file and not available for anyone below the age of 15. You can focus on ages 15-17 ("children" are defined by UNICEF to be anyone age 0-17) or on 15-19 (adolescents) or 15-24 (youth). Those are really your only options, so far as I can see.
|
|
|