The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Malaria » TOGO 2017 Malaria Indicator Survey (Need help to merge the PR and KR databases of TOGO using R Commander)
Re: TOGO 2017 Malaria Indicator Survey [message #22461 is a reply to message #22453] Tue, 16 March 2021 15:10 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3017
Registered: February 2013
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

I just did this with Stata, using code that I will paste below. I hope you can convert to R. The KR file includes all children born in the past five years. It includes 90 children who have died (b5=0), for whom b16 is a dot for Not Applicable. It includes 54 children who are not living with the mother, for whom b16 is 0. All the other children in the KR file merge successfully with the PR file.

use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\TGKR71FL.DTA" 
keep v001 v002 b*
tab b16,m
gen hv001=v001
gen hv002=v002
gen hvidx=b16
sort hv001 hv002 hvidx
save e:\DHS\DHS_data\scratch\temp.dta, replace


use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\TGPR71FL.DTA" 
keep hv001 hv002 hvidx hv101-hv105
sort hv001 hv002 hvidx
merge hv001 hv002 hvidx using e:\DHS\DHS_data\scratch\temp.dta
tab b16 _merge,m
 
Read Message
Read Message
Read Message
Previous Topic: Nigeria Malaria Indicator Survey
Next Topic: Malaria in pregnancy Zimbabwe
Goto Forum:
  


Current Time: Fri Mar 29 00:46:08 Coordinated Universal Time 2024