Re: Proportions [message #10608 is a reply to message #10603] |
Tue, 16 August 2016 10:40 |
Bridgette-DHS
Messages: 3230 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS Stata Specialist, Tom Pullum:
I suggest that you construct the proportion of households in the cluster that have electricity with a collapse command. You could do this from the HR file or from the PR file, selecting one record per household. Then merge that back with the PR file or whatever other file you are using. The lines below show how to construct this proportion. You do not need to use the weights because the weights are constant within clusters. Let me know if this is not what you need.
use KEPR70FL.dta, clear
keep if hvidx==1
keep hv001 hv206
tab hv206
collapse (mean) hv206, by(hv001)
rename hv206 electricity
label variable electricity "Prop. of hh in cluster with elect."
sort hv001
* next merge this file with whatever other file you are using
|
|
|