* Calculate the 3 components and the combined indicator for sexual violence
* Standard table for "Forms of spousal violence: Women" and "Spousal violence
* by background characteristics: Women", which only uses the combined indicator
* Illustrated with the Uganda 2006 survey, UG52
* Use codes 0/100 to get percentages with tabstat; for other purposes use 0/1
use "...UGIR52FL.DTA", clear
gen v_sexualA=0
replace v_sexualA=100 if d105h>0 & d105h<9
gen v_sexualB=0
replace v_sexualB=100 if d105i>0 & d105i<9
gen v_forced=0
replace v_forced=100 if d123==2 | d124==1 | d125==1
gen v_ini=0
replace v_ini=100 if v503==1 & d123==2 & (d127==1 | d127==2)
gen v_sexualC=0
replace v_sexualC=100 if (v_forced==100 & v_ini==100)
gen v_sexual=0
replace v_sexual=100 if v_sexualA==100 | v_sexualB==100 | v_sexualC==100
tabstat v_sexual* if v502>0 [fweight=d005], statistics(mean) by(v024)
]]>