Hi!
I am working with a large dataset of households. I want to choose a reference person per household and apply their information to all observations.
Right now I created dummies for the selection variable, counted it and dropped per year the persons from the household with less total observations. This works for 95% of households, except in:
1. If the selected person didn't fill in the survey of a specific year, but someone else from the household did
2. If only 2 years are available, with different persons filling in the survey.
How can I solve those issues? For clarity, I want to keep all observations, but for certain variables I want to change them to the reference person.
Something like : by(House-id): replace Birthyear = 'most common birthyear within household' if Count< largest Count within household
Thank you in advance!
I am working with a large dataset of households. I want to choose a reference person per household and apply their information to all observations.
Right now I created dummies for the selection variable, counted it and dropped per year the persons from the household with less total observations. This works for 95% of households, except in:
1. If the selected person didn't fill in the survey of a specific year, but someone else from the household did
2. If only 2 years are available, with different persons filling in the survey.
How can I solve those issues? For clarity, I want to keep all observations, but for certain variables I want to change them to the reference person.
Something like : by(House-id): replace Birthyear = 'most common birthyear within household' if Count< largest Count within household
Year | House-id | Member | Birthyear | House income | Count |
1996 | 21 | 1 | 1942 | 30 | 3 |
1997 | 21 | 1 | 1942 | 31 | 3 |
1998 | 21 | 3 | 1980 | 32 | 1 |
1999 | 21 | 1 | 1942 | 33 | 3 |
Thank you in advance!
Comment