The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » Are the merging commands and results correct (Verifying the correctness of IR and PR Files merging command)
Are the merging commands and results correct [message #18794] Sat, 22 February 2020 16:19 Go to previous message
okunloladavid is currently offline  okunloladavid
Messages: 4
Registered: February 2020
Member
Dear all,

Please I need your help in checking if the commands below are valid.

I am merging the IR file (in 2018 the Nigerian Demographic and Health Survey). This is because, I wanted the socio-demographics, economic characteristics and nutritional status of women (BMI) in the IR file appearing in the PR file since the PR file contains dejure and defacto respondents and should be linkable to the IR. I intend examining the relationship between maternal nutritional status and U5 children's nutritional statust (wasting, underweight etc). among others.

These are my commands:

//Preparing PR recode for merging
***Preparing women recode for merging
cd " C:\Users\USER\Documents\NG_2018_DHS_11292019_1323_116593\NGP R7ADT "
use "NGPR7AFL.DTA",clear
rename hv001 v001
rename hv002 v002
sort v001 v002 hvidx
duplicates list v001 v002 hvidx
save "C:\Users\USER\Desktop\Papers, Journals, project\Lawal\New project\PR.dta", replace


//Preparing IR recode for merging
cd " C:\Users\USER\Documents\NG_2018_DHS_11292019_1323_116593\NGI R7ADT "
use caseid v000 v001 v002 v003 v004 v131 v130 v717 v445 v106 v013 v190 v717 v025 v130 v131 v024 using "NGIR7AFL.DTA", clear
rename v003 hvidx
sort v001 v002 hvidx
duplicates list v001 v002 hvidx
save "C:\Users\USER\Desktop\Papers, Journals, project\Lawal\New project\Data 2.dta", replace

//merging IR to PR file
cd "C:\Users\USER\Desktop\Papers, Journals, project\Lawal\New project"
use "PR.dta",clear
merge 1:1 v001 v002 hvidx using "Data 2.dta"

//keeping cases (matched and unmatched)
keep if _merge==1 |_merge==3



I noticed that total observations for variables are so different.

I will be glad to hear from anyone. Thank you very much.

 
Read Message
Read Message
Read Message
Previous Topic: INDIA - NFHS-4 - PR AND CR
Next Topic: Merging variables from original DHS with IPUMS DHS
Goto Forum:
  


Current Time: Fri Apr 19 03:09:12 Coordinated Universal Time 2024