The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » General » DISABILITY - UGANDA DHS 2016
DISABILITY - UGANDA DHS 2016 [message #16706] Fri, 22 February 2019 07:19 Go to next message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
To whom it may concern.

A Stata do file to match figures on disability (Washington Group questions) in the Uganda DHS 2016 report.

clear all
set maxvar 9000
set mem 1g
cd "C:\Users\Dubile\Documents\UGANDA DHS 2016\UG_2016_DHS_02212019_82_52565\UGPR7ADT"
use "UGPR7AFL", clear
set more off

** ========================================================================== **
** WEIGHT VARIABLE
gen weight = hv005/1000000

** ========================================================================== **

** SURVEY SET
gen psu =    hv021
gen strata = hv023

svyset psu [pw = weight], strata(strata) vce(linearized)

** ========================================================================== **

sort hhid hvidx

* Generate "pid"
by hhid: gen pid = _n

* Creating household size
by hhid: generate hhsize=_N

egen hhtag = tag(hhid)

*br hhid hvidx pid hhsize hhtag

** ========================================================================== **
cap drop Seeing
gen Seeing =9 if sh24 == 9 | sh25 == 9
replace Seeing = 1 if sh24 == 1 | sh25 == 1
replace Seeing = 2 if sh24 == 2 | sh25 == 2
replace Seeing = 3 if sh24 == 3 | sh25 == 3
replace Seeing = 4 if sh24 == 4 | sh25 == 4
replace Seeing = 8 if sh24 == 8 | sh25 == 8

cap drop Hearing
gen Hearing =9 if sh27 == 9 | sh28 == 9
replace Hearing = 1 if sh27 == 1 | sh28 == 1
replace Hearing = 2 if sh27 == 2 | sh28 == 2
replace Hearing = 3 if sh27 == 3 | sh28 == 3
replace Hearing = 4 if sh27 == 4 | sh28 == 4
replace Hearing = 8 if sh27 == 8 | sh28 == 8

** RENAME VARIABLES **
rename sh29 Communicate
rename sh30 Remembering
rename sh31 Walking
rename sh32 Selfcare

** REPLACE **
replace Seeing 		= 8 if Seeing == .
replace Hearing 	= 8 if Hearing == .
replace Communicate = 8 if Communicate == .
replace Remembering = 8 if Remembering == .
replace Walking 	= 8 if Walking == .
replace Selfcare 	= 8 if Selfcare == .

** ========================================================================== **

global disa2 "Seeing Hearing Communicate Walking Remembering Selfcare"

gen	disab		=	0
gen	sevdisab	=	0
gen	undisab1	=	0
gen	undisab2	=	0
gen	undisab		=	0
gen	discount	=	0
gen	donotknow	=	0

foreach xvar in $disa2 {
	replace	disab	=	1 if `xvar'>=3 & `xvar'<=4
	replace	sevdisab	=	1 if `xvar'>=3 & `xvar'<=4
}
*

foreach xvar in $disa2 {
	replace	undisab2	=	1 if `xvar'>=3 & `xvar'<=4
}
*

quietly forval q = 1/6 {
	egen temper = anycount($disa2) if `q' !=., values(9)
	replace discount = temper
    drop temper
}
*

quietly forval v = 1/6 {
	egen tempers = anycount($disa2) if `v' !=., values(8)
	replace donotknow = tempers
    drop tempers
}
*

quietly forval s = 1/6 {
	egen new_temp = anycount($disa2) if `s' !=., values(4)
	replace undisab1 = new_temp
    drop new_temp
}
*
replace	undisab	=	1	if	undisab1 > 1
replace	undisab	=	1	if	undisab2 == 1

foreach xvar in discount {
	replace	undisab		=	9 if `xvar' == 6
	replace	disab		=	9 if `xvar' == 6
	replace	sevdisab	=	9 if `xvar' == 6
}
*

foreach xvar in donotknow {
	replace	undisab		=	8 if `xvar' == 6
	replace	disab		=	8 if `xvar' == 6
	replace	sevdisab	=	8 if `xvar' == 6
}
*

** ========================================================================== **

** DISABILITY INDEX

gen Ungandadisab = undisab
replace Ungandadisab = 0 if undisab == 8
label var Ungandadisab "Washington Group recommended disability index"
label define Ungandadisab 0"Without disability" 1"With disability" 9"DNK/Unspecified"
label val Ungandadisab Ungandadisab

drop disab sevdisab undisab undisab1 undisab2 discount donotknow

** ========================================================================== **

recode hv105 (0/4=1 "0-4") (5/9=2 "5-9") (10/14=3 "10-14") (15/19=4 "15-19") ///
(20/24=5 "20-24") (25/29=6 "25-29") (30/34=7 "30-34") (35/39=8 "35-39") ///
(40/44=9 "40-44") (45/49=10 "45-49") (50/54=11 "50-54") (55/59=12 "55-59") ///
(60/64=13 "60-64") (65/69=14 "65-69") (70/74=15 "70-74") (75/79=16 "75-79") ///
(80/95=17 "80+") (98=18 "DNK"), gen(Age_5year_Groups)
label var Age_5year_Groups "Age in five-year age groups"
label val Age_5year_Groups Age_5year_Groups

recode hv105 (0/4=1 "0-4") (5/9=2 "5-9") (10/14=3 "10-14") (15/19=4 "15-19") ///
(20/29=5 "20-29") (30/39=6 "30-39") (40/49=7 "40-49") (50/59=8 "50-59") ///
(60/95=9 "60+") (98=10 "DNK"), gen(Agegroup)
label var Agegroup "Age groups"
label val Agegroup Agegroup

** ========================================================================== **

** DROP IF NOT WITHIN SAMPLE
qui regr Ungandadisab if hv103==1 & (hv105 >=5) & Ungandadisab !=9 [pw=weight]		
drop if e(sample)!=1

** ========================================================================== **
** CHECK **
svy: tab Agegroup Ungandadisab, percent format(%11.1f) row
svy: tab Agegroup Ungandadisab, count format(%11.0f) miss
svy: tab Agegroup Ungandadisab if hv105 >=15 & hv105 <98, percent format(%11.1f) row

** ========================================================================== **
** ========================================================================== **
** ========================================================================== **

** Table 2.15 Disability among adults by background characteristics  **
recode hv115 (.=9)

/* WOMEN */
svy: tab Agegroup Ungandadisab if hv105 >=15 & hv104==2, percent format(%11.1f) row
svy: tab hv115 Ungandadisab if hv105 >=15 & hv104==2, percent format(%11.1f) row
svy: tab hv025 Ungandadisab if hv105 >=15 & hv104==2, percent format(%11.1f) row
svy: tab hv024 Ungandadisab if hv105 >=15 & hv104==2, percent format(%11.1f) row
svy: tab hv106 Ungandadisab if hv105 >=15 & hv104==2, percent format(%11.1f) row
svy: tab hv270 Ungandadisab if hv105 >=15 & hv104==2, percent format(%11.1f) row

***********************

/* MEN */
svy: tab Agegroup Ungandadisab if hv105 >=15 & hv104==1, percent format(%11.1f) row
svy: tab hv115 Ungandadisab if hv105 >=15 & hv104==1, percent format(%11.1f) row
svy: tab hv025 Ungandadisab if hv105 >=15 & hv104==1, percent format(%11.1f) row
svy: tab hv024 Ungandadisab if hv105 >=15 & hv104==1, percent format(%11.1f) row
svy: tab hv106 Ungandadisab if hv105 >=15 & hv104==1, percent format(%11.1f) row
svy: tab hv270 Ungandadisab if hv105 >=15 & hv104==1, percent format(%11.1f) row

** ========================================================================== **
** =================================== END ================================== **
** ========================================================================== **

*svy: tab Age_5year_Groups Ungandadisab, percent format(%11.1f) row
*svy: tab Age_5year_Groups Ungandadisab, count format(%11.0f) miss

ssc install splitvallabels, replace //Need internet connection

splitvallabels Ungandadisab
graph hbar [aw=weight], ///
over(Ungandadisab, label(labsize(small)) relabel(`r(relabel)')) ///
ytitle("Percent of respondents", size(small)) ///
title("Disability status" ///
, span size(medium)) ///
blabel(bar, format(%4.1f)) ///
intensity(25)

splitvallabels Ungandadisab
graph hbar (count) [pw=weight], ///
over(Ungandadisab, label(labsize(small)) relabel(`r(relabel)')) ///
ytitle("Number of respondents", size(small)) ///
title("Disability status" ///
, span size(medium)) ///
blabel(bar, format(%4.0f)) ///
intensity(25)

exit

Re: DISABILITY - UGANDA DHS 2016 [message #17457 is a reply to message #16706] Fri, 22 March 2019 09:11 Go to previous message
jcon is currently offline  jcon
Messages: 3
Registered: May 2014
Location: United States
Member
Thank you for sharing; worked perfectly. You are a star.
Previous Topic: missing observations
Next Topic: men's survey
Goto Forum:
  


Current Time: Fri Oct 11 20:24:24 Coordinated Universal Time 2024