Merging several datasets [message #10871] |
Tue, 27 September 2016 08:14 |
|
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
|
|
|
Re: Merging several datasets [message #11431 is a reply to message #10871] |
Mon, 19 December 2016 13:42 |
Bridgette-DHS
Messages: 3215 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS Stata Specialist, Tom Pullum:
Quote:I can't imagine why you would want to merge these five files. The PR file is basically a reshaped version of the HR file. The KR file is a reduced version of the BR file. Virtually everything in the BR and KR files is in the IR file, reshaped. Can you give me an example of one specific outcome or indicator that you think would require such a merge?
|
|
|