4. TEMPLATE STATA CODE FOR 2022 MICRODATA ANALYSIS OF MICS6
/****
May 27, 2022
*This STATA code was prepared by Jaclyn yap, for any question, please email rcd@fordham.edu”
This STATA code is for generating the main analysis of the 2022 Disability Data Report using Multiple Indicator Cluster Survey 6 MICS6 data
This code is divided into two parts:
**I. Data Preparation Section
Clean and generate variables needed for analysis: use _HL, _HH, and _WM from folder:
_HL = household list – includes age, sex, relationship to HH, ever attended, and highest level of education
_HH = household level vars i.e. standard of living vars
_WM = women’s dataset – includes functional difficulty,marital status, and the rest of individual-level indicators
Then merge all three and save as MICS_raw.dta
** II. Analysis Section : Generate Disability and Indicator Vars (line #460+)
*****/
/**
**# Bookmark #1
- Data Preparation Section
*/
clear all
/*
HOUSEHOLD LIST MODULE
*/
use “{}MICS6\Malawi\Malawi_hl.dta” , clear
lookfor age HL3
*Age
fre HL6
clonevar age_new=HL6
*sex_new =1 male =2 female
fre HL4
clonevar sex_new=HL4
**EDUCATION
*Ever attended school
* ED9 Attended school during current school year (2076)
gen everattend_new=cond(mi(ED4)|ED4==9,.,cond(ED4==1,1,0))
*Educational Attainment
fre ED5A ED5B
clonevar edattain_new=ED5A
tab ED5B ED5A if age_new>=15,m
recode edattain_new (8 9=.) (0 1 =1) (2 3=2) (4 5=4)
replace edattain_new =2 if ED5A==1 & ED5B==8
replace edattain_new =3 if ED5A==3 & ED5B==4
*recode those who never attended school as less than primary education
replace edattain_new=1 if everattend_new==0
cap label def edattain 1 “Less than primary” 2 “Primary” 3 “Secondary” 4 “Higher than Secondary”
label val edattain_new edattain
save “{}MICS6\Malawi\Malawi_hl.dta” , replace
/*
WOMEN 15-49
*/
use “{}MICS6\Malawi\Malawi_wm.dta” , clear
*WGSS/functional difficulty vars for Women 18 to 49
clonevar seeing_diff_new=AF6
clonevar hearing_diff_new=AF8
clonevar mobility_diff_new=AF9
clonevar cognitive_diff_new=AF10
clonevar selfcare_diff_new=AF11
clonevar comm_diff_new=AF12
su seeing_diff_new hearing_diff_new mobility_diff_new cognitive_diff_new selfcare_diff_new comm_diff_new
*replace missing value 9 = NO RESPONSE
mvdecode seeing_diff_new hearing_diff_new mobility_diff_new cognitive_diff_new selfcare_diff_new comm_diff_new, mv(9=.a)
su seeing_diff_new hearing_diff_new mobility_diff_new cognitive_diff_new selfcare_diff_new comm_diff_new
*SEEING/HEARING AIDS
*Seeing Aid
gen seeing_aid=cond(mi(AF2)|AF2==8|AF2==9,.,cond(AF2==1,1,0))
*Hearing Aid
gen hearing_aid=cond(mi(AF3)|AF3==8|AF3==9,.,cond(AF3==1,1,0))
*Literacy Rate
* if woman ages 15-49 =1 if obtained secondary education or if not, can read whole parts of sentence
gen lit_new=cond(mi(WB6A)|WB6A==8,.,cond(WB6A<=1,0,1))
*able to read whole sentence:
replace lit_new=1 if lit_new==0 & WB14==3
*can’t read, only parts of sentence:
replace lit_new=0 if WB14==1|WB14==2
tab WB6A lit_new,m
**HEALTH
*Access to modern family planning methods
fre CP2
codebook CP4*,c
fre CP2
gen current_fp_modern=cond(mi(CP2)|CP2==9,.,cond(CP4A==”” & CP4B==”” & CP4C==”” & CP4D==”” & CP4E==”” & CP4F==”” & CP4G==”” & CP4H==”” & CP4I==”” & CP4J==””,0,1)) \tab CP2 current_fp_modern ,m
label var current_fp_modern “family planning using modern method”
*Missed activities due to menstruation
gen mh_activitymissed=cond(mi(UN16)|UN16==8|UN16==9,., cond(UN16==1,1,0))
tab UN16 mh_activitymissed,m
*HIV
lookfor HA*
*HIV awareness
fre HA1
gen hiv_aware=cond(mi(HA1)|HA1==9,.,cond(HA1==1,1,0))
tab hiv_aware
*generate variable
cap program drop know_gen
program define know_gen
args var_name q
gen `var_name’=cond(`q’==9|`q’==8|mi(`q’),.,cond(`q’==1,1,0))
end
fre HA8*
*Awareness of Mother to Child transmission
*among those who know…Percentage of women and men age 15-49 years who correctly identify all three means of mother-to-child transmission of HIV HA8~
tab HA1 HA8A,m
know_gen “hiv_pregnancy” “HA8A”
know_gen “hiv_delivery” “HA8B”
know_gen “hiv_breastfeed” “HA8C”
gen hiv_trans_momchild=cond(hiv_aware==0|mi(hiv_aware),.,cond(hiv_pregnancy==1 & hiv_delivery==1 & hiv_breastfeed==1,1,0))
label var hiv_trans_momchild “correctly identify all three means of mother-to-child transmission of HIV”
fre HA24
local q HA24
gen hiv_evertested=cond(`q’==9|`q’==8|mi(`q’),.,cond(`q’==1,1,0))
*Attitudes towards Domestic Violence
codebook DV*, c
*gen variable
cap program drop var_gen
program define var_gen
args var_name q
gen `var_name’=cond(`q’==8|`q’==9|mi(`q’),.,cond(`q’==1,1,0))
end
*Attitude components:
*DV1A If she goes out with out telling husband: wife beating justified
var_gen “dv_out” “DV1A”
tab DV1A dv_out,m
*DV1B If she neglects the children: wife beating justified
var_gen “dv_neglect” “DV1B”
tab DV1B dv_neglect,m
*DV1C If she argues with husband: wife beating justified
var_gen “dv_argue” “DV1C”
tab DV1C dv_argue,m
*DV1D If she refuses sex with husband: wife beating justified
var_gen “dv_refuse” “DV1D”
tab DV1D dv_refuse ,m
*DV1E If she burns the food: wife beating justified
var_gen “dv_burnfood” “DV1E”
tab DV1E dv_burnfood,m
*If any of the responses is yes
egen dv_beatingjust=rowmax(dv_out dv_neglect dv_argue dv_refuse dv_burnfood)
label var dv_beatingjust “Any reason =1 wife beating justified”
tab dv_beatingjust , m
**SUBJECTIVE WELLBEING
*Life Satisfaction
codebook LS1 LS2 LS3 LS4, c
*Generate happiness =1 if orig var == 1 very happy 2 somewhat happy
*LS1 Estimation of overall happiness (1 to 5 with 5 very UNHAPPY)
fre LS1
gen ls_happy=cond(LS1==9|mi(LS1),.,cond(LS1==1|LS1==2,1,0))
*LS2 Satisfaction with ladder step (range is 0 to 10 )
clonevar ls_satisfaction=LS2
recode ls_satisfaction (99=.)
*Optimism or Perception of a better life
*Percentage of women and men whose life improved during the last one year AND who expect that their life will be better after one year
fre LS3 LS4
gen ls_optimism=cond((LS3==9|mi(LS3)|LS4==9|mi(LS4)),.,cond(LS3==1 & LS4==1,1,0))
**PERSONAL ACTIVITIES
*Computer usage
su MT4 MT5 MT6*
fre MT4
var_gen “computer_everused” “MT4”
tab MT4 computer_everused, m
*Internet usage
fre MT9
var_gen “internet_everused” “MT9”
tab MT9 internet_everused, m
*mobile ownership women
var_gen “mobile_own” “MT11”
tab mobile_own MT11
*frequency usage in last 3 months
gen mobile_frequent= cond(MT12==9|mi(MT12),.,cond(MT12==0|MT12==1,0,1))
*Media Exposure Variables
codebook MT1 MT2 MT3
*variable generator
cap program drop freq_gen
program define freq_gen
args var_name q
gen `var_name’=cond(`q’==9|mi(`q’),.,cond(`q’==2|`q’==3,1,0))
end
* freq at least once a week or almost everyday
freq_gen “media_newsp_mag” “MT1”
freq_gen “media_radio” “MT2”
freq_gen “media_tv” “MT3”
tab1 media_*
*Percentage of women and men age 15-49 years who, at least once a week, read a newspaper or magazine, listen to the radio, and watch television
egen media_exp=rowmax(media_newsp_mag media_radio media_tv)
tab media_exp
*INSECURITY
*Safety
codebook VT20 VT21
*Among those who do walk alone, they felt “Very Safe” or “Safe”
gen safe_feel_walkalone=cond(mi(VT20)|VT20==9|VT20==7,.,cond(inlist(VT20, 1,2),1,0))
*Discrimination Variables:
codebook VT22*,c
*EQ7 Percentage of women and men age 15-49 years having personally felt discriminated against or harassed within the previous 12 months on the basis of a ground of discrimination prohibited under international human rights law
*disability discrimination
gen disc_disa=cond(mi(VT22F)|VT22F==8|VT22F==9,.,cond(VT22F==1,1,0))
tab disc_disa VT22F,m
* gender discrimination
fre VT22B
gen disc_gender=cond(mi(VT22B)|VT22B==8|VT22B==9,.,cond(VT22B==1,1,0))
tab disc_gender VT22B,m
*any discrimination
egen disc_any=rowmin(VT22A VT22B VT22C VT22D VT22F VT22X)
mvdecode disc_any, mv(8 9=.)
recode disc_any (2=0)
tab disc_any
*Health insurance
fre WB18
local q WB18
gen health_insurance=cond(`q’==9|`q’==8|mi(`q’),.,cond(`q’==1,1,0))
save “{}MICS6\Malawi\Malawi_wm.dta”, replace
*HOUSEHOLD MODULE
use “{}MICS6\Malawi\Malawi_hh.dta” , clear
fre HH6
*urban_new: =1 rural =2 urban
gen urban_new=cond(HH6==1,2,1)
label var urban_new “=1 rural =2 urban”
tab urban_new HH6,m
*Asset components
*phone_new =1 with phone (telephone) =0
lookfor telephone
fre HC7A
gen phone_new= cond(HC7A==9|mi(HC7A),.,cond(HC7A==1,1,0))
tab phone_new HC7A,m
*cell_new/mobile phone at hh level =1 =0
lookfor mobile
fre HC12
local var HC12
gen cell_new= cond(`var’==9|mi(`var’),.,cond(`var’==1,1,0))
tab HC12 cell_new,m
*flooring where variable floor_new =1 if floor is rudimentary / unimproved
*floor_new (see def below) =1 if bad=0 if good
fre HC4
gen floor_new=cond(mi(HC4)|HC4==99,.,cond(inlist(HC4,11,12,21,22,96),1,0))
tab HC4 floor_new,m
*roof where variable roof_new =1 if roof is rudimentary / unimproved
*roof_new =1 if bad =0 if good
fre HC5
gen roof_new= cond(mi(HC5)|HC5==99,.,cond(inlist(HC5,11,12,21,22,23,24,96),1,0))
tab HC5 roof_new,m
*wall where variable wall_new =1 if wall is rudimentary / unimproved
*wall_new =1 if bad=0 if good
fre HC6
gen wall_new=cond(mi(HC6)|HC6 ==99,.,cond(inlist(HC6,11,12,13,21,22,23,24,25,26,36,96),1,0))
tab HC6 wall_new,m
*Clean Fuel
*fuelcook_new (see description below of clean fuel) =1 if good – NOT organic material =0 if bad – organic (dung, coal, etc)
*BLEN fuels (biogas, liquefied petroleum gas, electricity, and natural gas) are the cleanest solutions, able to reduce household air pollution emissions to the level of WHO guidelines safe for health.
fre EU1
tab EU1 EU4
gen fuelcook_new=cond(mi(EU1)|EU1==97|EU1==99,.,cond(inlist(EU1,1,2,3,4,5),1,0))
tab EU4 fuelcook_new,m
tab EU4 EU1
tab EU4 fuelcook_new,m
tab EU1 fuelcook_new,m
*electric_new =1 if yes =0 otherwise
fre HC8
gen electric_new=cond(mi(HC8)|HC8==9,.,cond(inlist(HC8,1),1,0))
**HEALTH
*sanitation
*toilet_new =1 with toilet (pit latrine, etc) =0 no toilet
fre WS11
local var WS11
gen toilet_new= cond(`var’==99|mi(`var’),.,cond(inlist(`var’,11,12,13,21,22,31),1,0))
*WS15 — Toilet facility shared
fre WS15
*reclassify if toilet is shared (yes) to unimproved sanitation
replace toilet_new=0 if WS15==1
tab WS11 toilet_new
*water indicator watsup_new where =1 if household has access to improved water source
*watsup_new
fre WS1
gen watsup_new= cond(mi(WS1),.,cond(inlist(WS1,11,12,13,14,21,31,41,51,91),1,0))
tab WS1 watsup_new,m
*Assets
*variable generator
cap program drop assets_gen
program define assets_gen
args var_name q
gen `var_name’=cond(`q’==9|mi(`q’),.,cond(`q’==1,1,0))
end
fre HC10E
*autos_new = with auto q= HC10E
* HC10E — Any member of household own: Car, truck or van
assets_gen “autos_new” “HC10E”
tab HC10E autos_new,m
*computer_new =1 if computer =0 q=HC11
fre HC11
assets_gen “computer_new” “HC11”
tab HC11 computer_new,m
*refrig_new =1 =0 q=HC9B
fre HC9B
assets_gen “refrig_new” “HC9B”
tab HC9B refrig_new,m
*tv_new =1 =0 q=HC9A
fre HC9A
assets_gen “tv_new” “HC9A”
tab HC9A tv_new,m
*radio_new =1 =0 q=HC7B
lookfor radio
assets_gen “radio_new” “HC7B”
tab HC7B radio_new,m
*bike_new =1 =0 q=HC10B
lookfor bike bicycle
assets_gen “bike_new” “HC10B”
tab HC10B bike_new,m
*motorcycle_new =1 =0 q=HC10C
lookfor motorcycle //
assets_gen “motorcycle_new” “HC10C”
*INSECURITY
*Any social assistance received
codebook _v106 _v107 _v108 _v109 _v110,c
codebook _v111 _v112 _v113 _v114 _v115,c
egen soc_assist=rowmin(_v106 _v107 _v108 _v109 _v110)
recode soc_assist (2=0)
egen soc_rec=rowmin(_v111 _v112 _v113 _v114 _v115)
recode soc_rec (2=0)
replace soc_assist=0 if soc_rec==0 & !mi(soc_assist)
tab soc_assist
recode soc_assist (8=.)
save “{}MICS6\Malawi\Malawi_hh.dta”, replace
/*
MERGE Modules _hl _hh _wm
*/
use “{}MICS6\Malawi\Malawi_hl.dta” , clear
gen LN=HL1
label var LN “line number to merge w Women module”
*merge household
merge m:1 HH1 HH2 using “{}MICS6\Malawi\Malawi_hh.dta”, keep(master matched) gen(hh_merge)
*merge women’s module
merge 1:1 HH1 HH2 LN using “{}MICS6\Malawi\Malawi_wm.dta”, keep(master matched) gen(women_merge)
label val seeing_diff_new hearing_diff_new mobility_diff_new cognitive_diff_new selfcare_diff_new comm_diff_new .
codebook seeing_diff_new hearing_diff_new mobility_diff_new cognitive_diff_new selfcare_diff_new comm_diff_new, c
save “{}MICS6\Malawi\Malawi_MICS6_raw.dta” , replace
/****
**# Bookmark #2
** II. Analysis Section : Generate Disability and Indicator Vars
****/
use “{}MICS6\Malawi\Malawi_MICS6_raw.dta” , clear
egen missing_funcq=rmiss2(seeing_diff_new hearing_diff_new mobility_diff_new cognitive_diff_new selfcare_diff_new comm_diff_new)
keep if age_new >= 18 & age_new <. & sex_new==2
keep if missing_funcq == 0
*Generate Functional difficulty indicators
egen func_difficulty=rowmax(seeing_diff_new hearing_diff_new mobility_diff_new cognitive_diff_new selfcare_diff_new comm_diff_new)
*Disaggregation A: None vs. Any Functional Difficulty
*Any functional difficulty =1 if response for 1 of 6 functional difficulty is 2, 3, or 4 , 0 otherwise
gen disability_any=0 if !mi(func_difficulty)
replace disability_any=1 if inrange(func_difficulty, 2, 4)
*Disaggregation B: None, Some, At least a lot of Functional Difficulty
*To compare None vs. Some difficulty
gen diff_none_some=cond(mi(func_difficulty)|inrange(func_difficulty, 3, 4),.,cond(func_difficulty==2,1,0))
*To compare None vs. At Least a lot of difficulty
gen diff_none_atleast=cond(mi(func_difficulty)|func_difficulty==2,.,cond(func_difficulty==3|func_difficulty==4,1,0))
*Disaggregation C: None vs. At least a lot of Functional Difficulty
*At least a lot functional difficulty if response for 1 of 6 functional difficulty is 3, or 4 , 0 otherwise
gen disability_atleast=0
replace disability_atleast=1 if inrange(func_difficulty, 3, 4)
*For analysis by type of functional difficulty : Indicator var =1 if respondent reports any difficulty (2,3,4) for each type
foreach var of varlist seeing_diff_new hearing_diff_new mobility_diff_new cognitive_diff_new selfcare_diff_new comm_diff_new {
`var’_ind=cond(mi(`var’),., cond(`var’!=1,1,0))
}
************************
*Generate Indicator variables
************************
**Education:
*Proportion of individuals who have ever attended school
gen ind_everattended=cond(mi(everattend_new),.,cond(everattend_new==0,0,1))
*Average highest educational level reached
*Less than Primary
gen ind_less_primary=cond(mi(edattain_new),.,cond(edattain_new==1,1,0))
*Primary
gen ind_primary=cond(mi(edattain_new),.,cond(edattain_new==2,1,0))
*Secondary or Higher
gen ind_atleastsecondary=cond(mi(edattain_new),.,cond(edattain_new==3|edattain_new==4,1,0))
*Literacy Rate
gen ind_literacy=cond(lit_new==1,1,0)
**Personal Activities:
*Computer use
gen ind_comp_used=cond(mi(computer_everused),.,computer_everused)
*Internet use
gen ind_int_used=cond(mi(internet_everused),.,internet_everused)
*Own Mobile Phone
gen ind_mobile_own=cond(mi(mobile_own),.,mobile_own)
*Media Exposure
gen ind_media_exp = cond(mi(media_exp),.,media_exp)
**Health:
*access to safe drinking water
gen ind_water=cond(mi(watsup_new),.,cond(watsup_new==1,1,0))
*proportion of population using safely managed sanitation services
gen ind_toilet=cond(mi(toilet_new),.,cond(toilet_new==1,1,0))
*proportion of population with access to electricity
gen ind_electric=cond(mi(electric_new),.,cond(electric_new==1,1,0))
*proportion of population using clean fuel
gen ind_cleanfuel=cond(mi(fuelcook_new),.,cond(fuelcook_new==1,1,0))
*Access to Modern contraceptive
gen ind_fp_modern=cond(mi(current_fp_modern),.,current_fp_modern)
*Attitude towards Domestic Violence
gen ind_dv_attitude=cond(mi(dv_beatingjust),.,dv_beatingjust)
*HIV awareness
gen ind_hiv_aware =cond(mi(hiv_aware),.,hiv_aware )
*HIV knowledge of mother-to-child transmission
gen ind_hiv_momchild_know=cond(mi(hiv_trans_momchild),.,hiv_trans_momchild)
*HIV Ever tested
gen ind_hiv_evertested=cond(mi(hiv_evertested),.,hiv_evertested)
*Missed Activities due to Menstruation
gen ind_mh_activitymiss= cond(mi(mh_activitymissed),.,mh_activitymissed)
**Standard of Living
*Mobile phone in household
gen ind_cell=cond(mi(cell_new),.,cond(cell_new==1,1,0))
*Asset Ownership
*First check if these vars exist and check is stored in global var:
local variable_tocheck “radio_new tv_new autos_new computer_new refrig_new phone_new cell_new motorcycle_new bike_new ”
foreach var in `variable_tocheck’ {
capture confirm variable `var’, exact
if !_rc {
*display “`var’ exists”
global `var’ = 1
}
else {
*display “`var’ does not exist”
global `var’ = 0
}
}
*Create an index that sums all existing assets in dataset (at least 1).
*Create dummy for each type of assets. Sum of dummies, max number of assets owned
if($phone_new == 1){
gen ind_phone=cond(mi(phone_new),.,cond(phone_new==1,1,0))
}
else{
gen ind_phone = 0
}
if($autos_new == 1){
gen ind_autos=cond(mi(autos_new),.,cond(autos_new==1,1,0))
}
else{
gen ind_autos = 0
}
if($computer_new == 1){
gen ind_computer=cond(mi(computer_new),.,cond(computer_new==1,1,0))
}
else{
gen ind_computer = 0
}
if($refrig_new == 1){
gen ind_refrig=cond(mi(refrig_new),.,cond(refrig_new==1,1,0))
}
else{
gen ind_refrig = 0
}
if($tv_new == 1){
gen ind_tv=cond(mi(tv_new),.,cond(tv_new==1,1,0))
}
else{
gen ind_tv = 0
}
if($radio_new == 1){
gen ind_radio=cond(mi(radio_new),.,cond(radio_new==1,1,0))
}
else{
gen ind_radio = 0
}
if($bike_new == 1){
gen ind_bike=cond(mi(bike_new),.,cond(bike_new==1,1,0))
}
else{
gen ind_bike = 0
}
if ($motorcycle_new == 1){
gen ind_motorcycle=cond(mi(motorcycle_new),.,cond(motorcycle_new==1,1,0))
}
else{
gen ind_motorcycle = 0
}
egen ind_asset_ownership = rowtotal(ind_phone ind_cell ind_autos ind_computer ind_refrig ind_tv ind_radio ind_bike ind_motorcycle)
replace ind_asset_ownership = ind_assets/($phone_new + $autos_new + $cell_new + $computer_new + $refrig_new + $tv_new + $radio_new +$motorcycle_new + $bike_new )
*Living Conditions Indicator
*note: floor_new roof_new wall_new were coded as deprivations
*if any one of three components is poor then living condition =0
gen ind_livingcond = cond(floor_new == 1|roof_new==1| wall_new ==1,0,1)
*Multidimensional Poverty headcount
*recode dimensions as deprivations
gen deprive_health_water=cond(mi(watsup_new),.,cond(watsup_new==0,1,0))
gen deprive_health_sanitation=cond(mi(toilet_new),.,cond(toilet_new==0,1,0))
gen deprive_sl_electricity=cond(mi(electric_new),.,cond(electric_new==0,1,0))
gen deprive_sl_fuel=cond(mi(fuelcook_new),.,cond(fuelcook_new==0,1,0))
gen deprive_sl_housing = cond(floor_new == 1|roof_new==1| wall_new ==1,1,0)
gen deprive_sl_asset=cond(mi(ind_assets),.,cond(ind_assets==0,1,0))
*education: deprived if less than primary
*weight of dimension is 1/3 or 0.33
gen deprive_educ=cond(mi(edattain_new),.,cond(edattain_new==1,0.33,0))
*generate temp var
egen health_temp=rowtotal(deprive_health_water deprive_health_sanitation)
egen sl_temp=rowtotal(deprive_sl_electricity deprive_sl_fuel deprive_sl_housing deprive_sl_asset)
*we assume that dimensions can not be missing but indicators inside can be missing. The dimension weights remain the same but the indicators weights should change
egen missing_health=rmiss2(deprive_health_water deprive_health_sanitation)
replace missing_health=2-missing_health
egen missing_sl=rmiss2(deprive_sl_electricity deprive_sl_fuel deprive_sl_housing deprive_sl_asset)
replace missing_sl=4-missing_sl
*health : weight is 0.33
gen deprive_health=(1/missing_health)*0.33*health_temp
*standard of living : weight is 0.33
gen deprive_sl=(1/missing_sl)*0.33*sl_temp
*check if any dimension missing, then missing
gen mdp_score=cond(mi(deprive_educ)|mi(deprive_health)|mi(deprive_sl),.,deprive_educ+deprive_health+deprive_sl)
gen ind_mdp=cond(mi(mdp_score),.,cond(mdp_score>0.33,1,0))
replace ind_mdp=0 if mi(ind_mdp)
**Insecurity:
*Feelings of safety
gen ind_safe_feelwalkalone = cond(mi(safe_feel_walkalone),.,safe_feel_walkalone)
*Discrimination: disability
gen ind_discr_disa = cond(mi(disc_disa),.,disc_disa)
*Discrimination: gender
gen ind_discr_gender = cond(mi(disc_gender),., disc_gender )
*Discrimination: any
gen ind_discr_any = cond(mi(disc_any),.,disc_any)
*Social Assistance
gen ind_soc_assist = cond(mi(soc_assist),.,soc_assist)
**Subjective Wellbeing:
*Happiness
gen ind_ls_happy=cond(mi(ls_happy ),.,ls_happy )
*Mean Life Satisfaction
gen ind_ls_satis_mean=cond(mi(ls_satisfaction ),.,ls_satisfaction )
*Optimism
gen ind_ls_optimism=cond(mi(ls_optimism ),.,ls_optimism )
save “{}MICS6\Malawi\Malawi_MICS6.dta” , replace
use “{}MICS6\Malawi\Malawi_MICS6.dta” , clear
*Template for analysis:
svyset [pweight=wmweight]
*Share of those who use assistive device for seeing (seeing_aid) among those with seeing difficulties
svy: mean seeing_aid if seeing_diff_new >1 & !mi(seeing_diff_new)
*Share of those who use assistive device for hearing (hearing_aid) among those with hearing difficulties
svy: mean hearing_aid if hearing_diff_new >1 & !mi(hearing_diff_new)
*replace indicator here
local indicator_variable “”
local disability_variable “”
*Calculate the means
svy: mean `indicator_variable’, over(`disability_variable’)
*Calculate the difference and the p-value of the difference
lincom _b[c.`indicator_variable’@0bn.`disability_variable’] – _b[c.`indicator_variable’@1.`disability_variable’]