Orphan non-orphan school attendance ratio [message #17435] |
Sun, 17 March 2019 11:20 ![Go to next message Go to previous message](/theme/default/images/down.png) |
Mercysh
Messages: 35 Registered: April 2014
|
Member |
|
|
I need help with a code for generating orphan to non-orphan school attendance ratio at regional level using the 2015 Malawi DHS. I have the following code but I am stuck in the process:
gen orphan_age = hv105 >=10 & hv105 <=14
gen school_attendance = hv121 ==2
gen orphaned_m = hv111 ==0 & orphan_age==1
gen orphaned_f = hv113 ==0 & orphan_age==1
gen livingwith_mother = hv112 >= 1 & hv112 <=19
gen livingwith_father = hv114 >= 1 & hv114 <=16
gen nonorphanlivingparent = ((orphaned_m ==0 & livingwith_mother ==1) | (orphaned_f==0 & livingwith_father ==1))
egen Total1 = total((orphaned_m ==1 | orphaned_f ==1) & school_attendance ==1)
egen Total2 = total(nonorphanlivingparent ==1 & school_attendance ==1)
gen ratio = Total1/Total2
egen tag = tag(District)
I do not want to collapse because I have variables at a level different from region
Mercy
|
|
|