The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Kenya » Orphan non-orphan school attendance ratio
Orphan non-orphan school attendance ratio [message #17435] Sun, 17 March 2019 11:20 Go to previous message
Mercysh is currently offline  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
 
Read Message
Read Message
Previous Topic: Domestic violence
Next Topic: Ethical approval
Goto Forum:
  


Current Time: Mon Apr 29 09:02:25 Coordinated Universal Time 2024