The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging Child and Household data for a new user of Stata
Re: Merging Child and Household data for a new user of Stata [message #26642 is a reply to message #26638] Wed, 12 April 2023 11:28 Go to previous messageGo to previous message
rachelsb98 is currently offline  rachelsb98
Messages: 6
Registered: April 2023
Member
I was able to do it with the ALbania dataset. However, with my Angola dataset, I was able to complete it. However, almost half of the data did not match. Is this okay? I just want to ensure I'm not doing something wrong.

Here is my code for reference:
set more off
clear

set maxvar 32000
set more off
clear

use "D:\Raw data sets\Angola\Angola 15-16 HH Raw\AOPR71FL.DTA"
keep hc60 hvidx hv001 hv002 hv007 hv000 hv246 hv235 hv238a hv014
drop if hc60>18
rename hvidx c_line
rename hv001 cluster_line
rename hv002 hh_line
rename hc60 mom_line
order c_line cluster_line hh_line mom_line
gsort c_line cluster_line hh_line mom_line
save "D:\Raw data sets\Angola\Angola 15-16 HH Raw\Angola 15-16 Merge.DTA", replace

use "D:\Raw data sets\Angola\Angola 15-16 Raw\Angola 15-16 Raw.DTA"
keep v000 v007 b16 v001 v002 v003 v465 v190 v012 v102 v106 m39a v113 v116 v160 v501 v157 v158 v159 m70 h43
drop if b16==0|b16==.
rename b16 c_line
rename v001 cluster_line
rename v002 hh_line
rename v003 mom_line
order c_line cluster_line hh_line mom_line
gsort c_line cluster_line hh_line mom_line

merge 1:1 c_line cluster_line hh_line mom_line using "D:\Raw data sets\Angola\Angola 15-16 HH Raw\Angola 15-16 Merge.DTA"



Thank you you've been very helpful
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Merging KR to MR OR (KR, IR, MR)
Next Topic: How to merge KR and IR
Goto Forum:
  


Current Time: Tue Nov 26 17:11:54 Coordinated Universal Time 2024