The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » Kenya » Proportions
Proportions [message #10603] Tue, 16 August 2016 06:22 Go to previous message
Khanjila is currently offline  Khanjila
Messages: 7
Registered: July 2016
Member
I would like to create the proportion of households in a cluster that have access to electricity.

This is what I have done:

bys hv001: gen proportion= sum(hv206)/_N
bys hv001: replace proportion= proportion[_N]


However, I realized that since there can be duplicate households in a cluster as shown below. (This is because my study is focusing on impact of electricity on school attendance and so there can multiple children in a household who attend school)
hv001	hv002
2	76
2	76
2	76
3	7
3	7
3	23
3	39
3	39
3	39
3	47
3	56
3	80
3	80


I tried using
duplicates drop household number

Before proceeding with the previous syntax. But my sample reduced drastically to around 147 from about 9000.

Is there something I am doing wrong?
Or is there a better method of getting the proportion of households in a cluster with access to electricity?
 
Read Message
Read Message
Previous Topic: Missing variables in data set
Next Topic: House hold sample weight
Goto Forum:
  


Current Time: Thu Apr 25 15:43:41 Coordinated Universal Time 2024