Re: Number of graduates in a household [message #26624 is a reply to message #26621] |
Tue, 11 April 2023 09:21 |
Bridgette-DHS
Messages: 3199 Registered: February 2013
|
Senior Member |
|
|
Following is a response from Senior DHS staff member, Tom Pullum:
The following Stata program will calculate this, using the HR file. I don't know how many years would define "graduate", so I illustrate with 12 (that is, 12 or more completed years of schooling). You can alter that. You might want to take into account the size of the household (hv009) and whether the person is de jure, that is, a usual member of the household.
If this were done with the PR file, you would use the "egen" commands.
use "...IAHR7DFL.DTA"
* Calculate the number of household members who have Y or more years of schooling
* You may want to restrict to de facto or de jure household members
* Use hv108, completed number of years of schooling
* Special codes for hv108: 97=inconsistent and 98=DK
* Specify the threshold as a scalar, for example sY=12
scalar sY=12
* Initialize the household-level variable
gen ngraduates=0
* Remove leading 0's in the subscripts
rename *_0* *_*
* Households have up to 35 members. Loop through all of them.
quietly forvalues li=1/35 {
replace ngraduates=ngraduates+1 if hv108_`li'>=sY & hv108_`li'<97
}
tab ngraduates
|
|
|