Matching the Kenya 2014 DHS domestic violence data [message #11175] |
Tue, 15 November 2016 05:23 |
npolle
Messages: 6 Registered: August 2016 Location: MOMBASA, KENYA
|
Member |
|
|
I am using the 2014 Kenya Demographic and Health Survey to determine domestic violence and associated risk factors. I am trying to match the domestic violence numbers in table Tables 16.1.1 of the final report. However I keep getting a total of 4018 women instead of 5,657. Kindly assist. Below are the stata codes that I used. Thank you.
*OPEN FILE
use "G:\scientific writing\VIOLENCE\KE_2014_DHS_11142016_37_61056\keir70dt\KEIR 70FL.DTA ", clear
* GENERATING THE VARIABLE 'sexualviolence'
generate sexualviolence=.
replace sexualviolence = 0 if d105h == 0| d105h == 9 | d105i == 0| d105i == 9 ///
| d105k == 0 | d105k == 9
replace sexualviolence = 1 if d105h == 1 | d105i == 1 | d105k == 1
replace sexualviolence = 1 if d105h == 2 | d105i == 2 | d105k == 2
replace sexualviolence = 1 if d105h == 3 | d105i == 3 | d105k == 3
replace sexualviolence = 1 if d105h == 4 | d105i == 4 | d105k == 4
label variable sexualviolence "EVER EXPERIENCED SEXUAL VIOLENCE"
label define sexual_violence 0 "Never" 1 "Often" 2 "Sometimes" ///
3 "Yes, but not in the last 12 months" 4 "Yes, but frequency in last 12 months missing"
label value sexual_violence sexualviolence
tab sexualviolence [iweight=d005/1000000]
*GENERATE VARIABLE "physicalviolence"
generate physicalviolence=.
replace physicalviolence = 0 if d105a - d105f == 0 | d105j == 0
replace physicalviolence = 1 if d105a - d105f == 1 | d105j == 1
replace physicalviolence = 2 if d105a - d105f == 2 | d105j == 2
replace physicalviolence = 3 if d105a - d105f == 3 | d105j == 3
replace physicalviolence = 4 if d105a - d105f == 4 | d105j == 4
label variable physicalviolence "EVER EXPERIENCED PHYSICAL VIOLENCE"
label define physical_violence 0 "Never" 1 "Often" 2 "Sometimes" ///
3 "Yes, but not in the last 12 months" 4 "Yes, but frequency in last 12 months missing"
label value physical_violence physicalviolence
tab physicalviolence [iweight=d005/1000000]
|
|
|
Re: Matching the Kenya 2014 DHS domestic violence data [message #11445 is a reply to message #11175] |
Thu, 22 December 2016 00:59 |
Trevor-DHS
Messages: 803 Registered: January 2013
|
Senior Member |
|
|
To match the number of women for the domestic violence module, use the following to initialize your sexualviolence or physicalviolence variables:
replace sexualviolence = 0 if v044==1
However, you have many other problems in your code:
1) You only ever assign values 0 or 1 to sexual violence, but you label values 2, 3, and 4 as well.
2) The label value statement should be as follows - you had the label and the variable names reversed:
label value sexualviolence sexual_violence 3) When creating your physicalviolence variable, you write:
replace physicalviolence = 0 if d105a - d105f == 0 | d105j == 0 but this is subtracting d105f from d105a and testing the result against 0. You need to add in a loop through the variables to test d105a to d105f individually. I suggest using something like:
gen physicalviolence = .
foreach dvar of var d105a d105b d105c d105d d105e d105f d105j {
replace physicalviolence = 0 if `dvar' == 0
} 4) You need to figure out the hierarchy order for each of the categories and test for them in the correct order.
Here is my best guess at the coding:
* GENERATING THE VARIABLE 'sexualviolence'
gen sexualviolence = 0 if v044==1
foreach dval in 1 2 4 3 {
foreach dvar of var d105h d105i d105k {
replace sexualviolence = `dval' if sexualviolence == 0 & `dvar' == `dval'
}
}
replace sexualviolence = 1 if sexualviolence == 0 & d130b == 1
replace sexualviolence = 3 if sexualviolence == 0 & d130b == 2
replace sexualviolence = 4 if sexualviolence == 0 & (d130b == 3 | d130b == 4)
replace sexualviolence = 2 if sexualviolence == 0 & d124 == 1
replace sexualviolence = 3 if sexualviolence == 0 & d125 == 1
label variable sexualviolence "EVER EXPERIENCED SEXUAL VIOLENCE"
label define sexual_violence 0 "Never" 1 "Often" 2 "Sometimes" ///
3 "Yes, but not in the last 12 months" 4 "Yes, but frequency in last 12 months missing" ///
5 "Yes, but no information when"
label value sexualviolence sexual_violence
tab sexualviolence [iweight=d005/1000000]
*GENERATE VARIABLE "physicalviolence"
gen physicalviolence = 0 if v044==1
foreach dval in 1 2 4 3 {
foreach dvar of var d105a d105b d105c d105d d105e d105f d105j d117a {
replace physicalviolence = `dval' if physicalviolence == 0 & `dvar' == `dval'
}
}
replace physicalviolence = 1 if physicalviolence == 0 & d130a == 1
replace physicalviolence = 3 if physicalviolence == 0 & d130a == 2
replace physicalviolence = 4 if physicalviolence == 0 & (d130a == 3 | d130a == 4)
replace physicalviolence = 4 if physicalviolence == 0 & d115y == 0
replace physicalviolence = 5 if physicalviolence == 0 & d118y == 0
label define physical_violence 0 "Never" 1 "Often" 2 "Sometimes" ///
3 "Yes, but not in the last 12 months" 4 "Yes, but frequency in last 12 months missing" ///
5 "Yes, but no information when"
label value physicalviolence physical_violence
tab physicalviolence [iweight=d005/1000000]
|
|
|
|
|
|