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)
TOGO 2017 Malaria Indicator Survey [message #22453] Mon, 15 March 2021 19:44 Go to next message
Gountante is currently offline  Gountante
Messages: 7
Registered: March 2021
Location: Anvers, Belgium
Member

Good morning,
I am working on the results of the malaria test in children and the characteristics of the mothers. I have been facing difficulties in merging KR and PR for the last two weeks. I am using in the child database the variables v001, v002, and b16 and in the household member database hv001, hv002, and hvidx. Since the variable hml32 contains some missing values I try to keep in my new merged database only the children whose test is negative or positive. But when I do the filter, it doesn't work. I have tried several times. I'm probably doing it wrong, that's why I'd like your help. I'm using R Commander

With thanks!
Kombate
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 next 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
Re: TOGO 2017 Malaria Indicator Survey [message #22466 is a reply to message #22461] Tue, 16 March 2021 16:25 Go to previous message
Gountante is currently offline  Gountante
Messages: 7
Registered: March 2021
Location: Anvers, Belgium
Member

Thank you very much for your very clear answer. I had mentioned a concern about how to filter my hml32 variable. Just keep in my new merged database, only the ones that did the malaria test under the microscope. That was really my problem
With thanks
kombate
Previous Topic: Nigeria Malaria Indicator Survey
Next Topic: Malaria in pregnancy Zimbabwe
Goto Forum:
  


Current Time: Thu Mar 28 13:18:19 Coordinated Universal Time 2024