The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Merging several datasets
Merging several datasets [message #10871] Tue, 27 September 2016 08:14 Go to previous message
DHS_OM is currently offline  DHS_OM
Messages: 11
Registered: July 2016
Location: Burkina Faso
Member

Dears forum and experts,
I have produced some statistics from the different data sets (5):
-IR, HR, PR, BR. KR files of Burkina Faso DHS 2010 survey.
My attempts are to be able to analyze some outcomes relative to children and mothers(mortalities) using one file that is suitable to compute these outcomes and reproduce the correct statistics.
below is my script.
I would appreciate any help or suggestions
1- if merging these 5 data sets is possible without destroying the structure of some individual data
2- if my codes are correct.
I went through the forum and i notice that to keep the children that have died or living away is tricky and do not get it well.


************************************************************ ********
************************************************************ ********
clear
cd "C:\.......\essay_merge"

use BFHR62FL
rename hv001 v001
rename hv002 v002
sort v001 v002

save C:\.......\HH_file, replace
/*merging households file to children file*/
use BFKR62FL
sort v001 v002
merge m:1 v001 v002 using C:\.......\HH_file.dta

drop _merge
save C:\.......\merge_1, replace /*Houeholed+kids file*/


************************************************************ ********
/*merging Houeholed+kids file to birth file*/
clear
use BFBR62FL
sort v001 v002 v003 midx
save C:\.......\BR_file, replace

use merge_1
sort v001 v002 v003 midx
merge m:m v001 v002 v003 midx using C:\.......\BR_file
drop _merge

save C:\.......\merge_2, replace /*Houeholed+kids+birth file*/


************************************************************ ********
/*merging Houeholed+kids+birth file to household members file*/

clear
use BFPR62FL
rename hv001 v001
rename hv002 v002
rename hvidx v003
sort v001 v002 v003
save C:\.......\PR_file, replace

use merge_2
sort v001 v002 v003
merge m:m v001 v002 v003 using C:\.......\PR_file
drop _merge

save C:\.......\merge_3, replace /*Houeholed+kids+birth+household members file*/


************************************************************ ********
/*merging Houeholed+kids+birth+household members file to women file*/
clear
use BFIR62FL
*rename hv001 v001
*rename hv002 v002
*rename hvidx v003
sort v001 v002 v003
save C:\.......\IR_file, replace

use merge_3
sort v001 v002 v003
merge m:m v001 v002 v003 using C:\.......\IR_file
drop _merge
save C:\.......\merge_4, replace /*final file*/

************************************************************ ********


omill
 
Read Message
Read Message
Previous Topic: Combining Household and Children recodes into one data file in STATA
Next Topic: combinning three files into one file
Goto Forum:
  


Current Time: Mon Apr 29 06:08:13 Coordinated Universal Time 2024