Re: Households with enough ITNs for every 2 people and or protected by IRS [message #12410 is a reply to message #12331] |
Thu, 11 May 2017 14:45 |
Liz-DHS
Messages: 1516 Registered: February 2013
|
Senior Member |
|
|
A response from malaria expert, Cameron Taylor:
Quote:
Hi Nelly,
While I can't pinpoint what the issue is in your code I can express caution in that in Stata if you divide by zero Stata yields a missing value. For example some households have a 0 value for hv013 which Stata changes to missing. Not sure if that is your issue or not.
Regardless here is code using Uganda 2014-15 MIS as an example
use "UGHR72FL.DTA", clear
gen wt=hv005/1000000
**Number of ITNs per household
g numitnhh=0
forvalues x=1/7 {
generate itnhh_0`x'=(hml10_`x'==1)
}
replace numitnhh=itnhh_01 + itnhh_02 + itnhh_03 + itnhh_04 + itnhh_05 + itnhh_06 + itnhh_07
lab var numitnhh "Number of ITNs per Household"
**Number of ITNs per person (de facto household member)
g itnpp=numitnhh/hv013
replace itnpp=0 if itnpp==.
lab var itnpp "Number of ITNs per person"
**Households with at least one ITN per every 2 people (de facto household members)
g uc=(itnpp>=0.5)
lab var uc "Households with at least one ITN per every 2 people (de facto household members)"
**IRS
**Was the household sprayed in the past 12 months by someone other than a household member
g irs=0
foreach x in a b c d e f g h {
replace irs=1 if hv253==1 & hv253`x'==1
}
lab var irs "Household sprayed in the past 12 months by someone other than a household member"
**ITN or IRS
**Does the household own at least one ITN OR was it sprayed by IRS in past 12 months?
g anyprot = 0
replace anyprot=1 if (irs==1|uc==1)
lab var anyprot "household own at least one ITN OR was it sprayed by IRS in past 12 months"
tab anyprot [iweight=wt]
|
|
|