Hi,
I have individual data (see below) where r101 is the province code, r401 is Person ID, r403 is each person's relation to household head (1 = HH head, 2 = spouse, 3 = child, etc), and r601 is the person ID of each person's mother (similar to r403). I'd like to generate Household ID (hhid) given the PID. E.g. Row 1 - 7 is one family, so the hhid = 1. Row 8 - 9 is one family, so the hhid = 2. Row 10 - 14 is one family, so the hhid = 3. Does anyone have any idea on how to do such a thing?
Thank you!
clear
input byte(r101 r401 r403 r601) float(age marstat gender)
11 1 1 0 40 2 0
11 2 2 0 39 2 1
11 3 3 2 17 1 0
11 4 3 2 13 1 0
11 5 3 2 12 1 1
11 6 3 2 6 1 1
11 7 3 2 0 1 1
11 1 1 0 39 2 0
11 2 2 0 47 2 1
11 1 1 0 36 2 0
11 2 2 0 33 2 1
11 3 3 2 12 1 0
11 4 3 2 8 1 0
11 5 3 2 0 1 0
end
Related Posts with How to create household ID given the person ID
Link Individuals to daily dates.Hi fellows, I have a paneldataset of 56.000 rows and I am trying to implement a DiD regression inclu…
How to solve the endogeneity problem in the XTologit model with utility variablesHi~ First of all, English is not my mother tongue, so please forgive me if the question is rude. How…
Individual fixed effects for xtlogit and xttobitDear Statalist, I run both a logit (xtlogit) and a tobit (xttobit) model for my research. I want to…
percentage change from baseline, Mixed modelI have a mixed effect model with unequal repeated measures rangr from time 1 to time 20. All subject…
VIF after .xtreg reCan somebody explain to me how I use VIF after .xtreg re? I get the following error: not appropria…
Subscribe to:
Post Comments (Atom)
0 Response to How to create household ID given the person ID
Post a Comment