-
Notifications
You must be signed in to change notification settings - Fork 3
/
adultequivhhsize.ado
executable file
·30 lines (21 loc) · 1.01 KB
/
adultequivhhsize.ado
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
program define adultequivhhsize, rclass
syntax , Age(varname numeric) Male(varname numeric) Generate(name) Scale(string) Over(varname numeric) Reltohead(varname numeric)
version 9.1
tempvar hhmemberweight
// different scales. Have not implemented McClemments' yet
if ("`scale'"=="shafique") {
qui gen `hhmemberweight' = .
qui replace `hhmemberweight' = 1 if `age' > 14 & `age' ~= .
qui replace `hhmemberweight' = 0.5 if `age' <= 14
}
else if ("`scale'"=="oecdm") {
// Use the OECD modified scale (http://www.oecd.org/LongAbstract/0,3425,en_2649_33933_35411112_1_1_1_1,00.html)
// sort `over' `age'
qui gen `hhmemberweight' = 1 if `reltohead' == 1
qui replace `hhmemberweight' = 0.5 if `reltohead' != 1 & `age' >= 15
qui replace `hhmemberweight' = 0.3 if `reltohead' != 1 & `age' < 15
}
// Now we calculate the adjusted household size, which will be stored in the variable named "generate"
qui cap drop `generate'
qui egen `generate' = total(`hhmemberweight'), by(`over')
end program