*Pillar 3 - Analysing VACS data* *Session 3.4 - Constructing and coding physical violence* *Step by step guide of how to construct physical violence variables* *In this guide, we will be coding a physical violence variable using the Cote d'Ivoire VACS data. There are lots of different physical violence variables you might want to code in the data depending on timeframe, perpetrator and acts. We are going to look at some different examples of coding physical violence. ******************************************************************************* *Setting up your data ******************************************************************************* *Cote d'Ivoire only has one dataset for all individuals, but note that some countries have separate datasets for males and females. If they are separate, depending on the analysis you are doing, you can either analyse them separately or merge the datasets before analysing them. *Set your working directory to the file location where you would like to save all files for your project, and load the dataset into stata. *cd "..." use CotedIvoire_pubuse_031522.dta *Make all the variables lower case. This will make it easier to code as Stata is case sensitive and the VACS survey has some variables in upper and some in lower case. rename *, lower ******************************************************************************* *Surveyset your data ******************************************************************************* *Now we need to surveyset our data to account for the complex sampling strategy used in the VACS surveys. *For Cote d'Ivoire, the stratification, cluster, and sample weight variables are strata, psu, EA, and sampleweight, respectively. Note that this varies by survey and you will need to check the variables for your country survey. The data summary file that you will receive with the dataset details this. gen weight=sampleweight svyset psu [pweight=weight], strata(strata) vce(linearized) singleunit(centered) ******************************************************************************* *Generate labels for your variables ******************************************************************************* *Here we generate labels for the variables that we plan to create. You can keep adding to this as you create all your variables, but it can help to have all the labels organised in a separate place to your variables. *Yes/No label (the version in the data is 1=yes, 2=No, 99=Don't know/declined) label define yesno 0 "No" 1 "Yes" 99 "DK/declined", replace *Age of first exposure label define exposureage_4cat 0 "0-5 years" 1 "6-11 years" 2 "12-17 years" 3 "18-24 years" 99 "Don't know/declined", replace // in four categories label define exposureage_3cat 0 "under 12 years" 1 "12-17 years" 2 "18-24 years" 99 "Don't know/declined", replace // in three categories label define exposureage 0 "0-17 years" 1 "18-24 years" 99 "Don't know/declined", replace // in two categories *Demographics label define sex 1 "male" 2 "female" label define age_binary 0"13-17 years" 1"18-24 years" ********************************************************************************** *Create variables your demographics ********************************************************************************** *It can be useful to start by creating or cleaning variables for demographics that you know will be important in your analysis. Age and sex are included here, but there are likely to be more that you will want to code. *Age - this could be a continuous, binary or categorical variable. Here, we create a binary variable for 13-17 year olds vs 18-24 year olds. clonevar age=q2 // this would be a continuous measure of respondent age gen age_binary=0 // this would be a binary variable where 0=13-17 years and 1=18-24 years replace age_binary=1 if inrange(age,18,24) label values age_binary age_binary tab age age_binary // always remember to tabulate your new variable against the existing variable to check for any errors you may have made when creating the variable. *Sex - there is already a variable. Here we label the values of the variable to make it easier to see which group represents males and which represents females. label values sex sex *************************************************************************************** *Creating the violence variables *************************************************************************************** *************************************************************************************** *Example: Lifetime experience of physical violence from any perpetrator *************************************************************************************** *The survey includes the following four acts of physical violence for each perpetrator: *slapped, pushed, shoved, shook, or intentionally threw something at you to hurt you? *punched, kicked, whipped, or beat you with an object? *choked, suffocated, tried to drown you, or burned you intentionally? *used or threatened you with a knife, gun or other weapon? *1=yes, 2=no, 99=dk/dta *************************************************************************************** *STEP 1: For each perpetrator, construct a measure of any lifetime physical violence *************************************************************************************** *Here, we will construct a variable for lifetime experience of any physical violence for each perpetrator separately. First let's start with estimating physical violence from an intimate partner. *Lifetime physical violence from a partner (only those ever partnered answered these questions) gen pv_ipv_ever=0 // our denominator is only those who have ever partnered replace pv_ipv_ever=1 if (q100a==1 | q100b==1 | q100c==1 | q100d==1) replace pv_ipv_ever=. if inlist(q100a,99,.,98) & inlist(q100b,99,.,98) & inlist(q100c,99,.,98) & inlist(q100d,99,.,98) // this codes the variable as 'missing' if the respondent responds 'Don't know' or declined to answer to all four items, or if ALL four items were missing. If an individual responds 'Don't know' or declined to answer for <4 items, or if <4 items are missing, then the individual will be coded as 0 or 1 depending on the answers to the remaining items and the individual would not be coded as missing. label values pv_ipv_ever yesno *Then check the variable that you've created tab pv_ipv_ever tab1 q100a q100b q100c q100d // check the prevalence of the individual items (note: these do not add up to the prevalence of the new variable as a child could have experienced 2 or more) *Here we tabulate the results and use the svy command to account for the survey sampling settings identified by svyset. svy:tab q100a, obs svy:tab q100b, obs svy:tab q100c, obs svy:tab q100d, obs svy:tab pv_ipv_ever,obs ci *Now let's move onto estimating physical violence from the other perpetrators - peers, caregivers and adults in the community or neighbourhood. We can do the same as we have done for partners. *Lifetime physical violence from a peer gen pv_peer_ever=0 // our denominator is the full sample replace pv_peer_ever=1 if q110a==1 | q110b==1 | q110c==1 | q110d==1 // any yes replace pv_peer_ever=. if inlist(q110a,99,.,98) & inlist(q110b,99,.,98) & inlist(q110c,99,.,98) & inlist(q110d,99,.,98) label values pv_peer_ever yesno tab pv_peer_ever *Check the original items tab1 q110a q110b q110c q110d svy:tab pv_peer_ever, obs *Lifetime physical violence from a caregiver gen pv_cgiver_ever=0 // our denominator is the full sample replace pv_cgiver_ever=1 if q120a==1 | q120b==1 | q120c==1| q120d==1 // any yes replace pv_cgiver_ever=. if inlist(q120a,99,.,98) & inlist(q120b,99,.,98) & inlist(q120c,99,.,98) & inlist(q120d,99,.,98) label values pv_cgiver_ever yesno tab pv_cgiver_ever *Check the original items tab1 q120a q120b q120c q120d svy:tab pv_cgiver_ever, obs *Lifetime physical violence from an adult in the community gen pv_adult_ever=0 // our denominator is the full sample replace pv_adult_ever=1 if q132a==1 | q132b==1 | q132c==1 | q132d==1 replace pv_adult_ever=. if inlist(q132a,99,.,98) & inlist(q132b,99,.,98) & inlist(q132c,99,.,98) & inlist(q132d,99,.,98) label values pv_adult_ever yesno tab pv_adult_ever *Check the original items tab1 q132a q132b q132c q132d svy:tab pv_adult_ever, obs *************************************************************************************** *STEP 2: Combine measures of physical violence for the timeframe *************************************************************************************** *Now that we have estimated lifetime physical violence separately for each perpetrator, we may want to combine these variables and look at experience of physical violence from any perpetrator. *Lifetime experience of any physical violence from any perpetrator gen pv_any_ever=0 replace pv_any_ever=1 if inlist(1, pv_ipv_ever, pv_peer_ever, pv_cgiver_ever, pv_adult_ever) // this replaces the variable to be coded as 1 if any of the four variables listed in the brackets are coded as 1 (i.e. the individual has experienced physical violence from any of the perpetrators) replace pv_any_ever=. if inlist(., pv_ipv_ever) & inlist(., pv_peer_ever) & inlist(., pv_cgiver_ever) & inlist(., pv_adult_ever) // this replaces the variable to be coded as missing if physical violence from all four perpetrators are missing label values pv_any_ever yesno tab pv_any_ever svy: tab pv_any_ever, obs ci *************************************************************************************** *Stratified by age *************************************************************************************** *Now let's tabulate the variables separately among 13-17 year olds and 18-24 year olds. svy:tab pv_ipv_ever age_binary, obs svy:tab pv_peer_ever age_binary, obs svy:tab pv_cgiver_ever age_binary, obs svy:tab pv_adult_ever age_binary, obs svy:tab pv_any_ever age_binary, obs ci