Dear all
I am quite new to stata and currently working with a dataset abouth health. This data comes from a survey where you have 2 sort of variables. First you have an individual variable, this different for every person The other sort is a household variable. Here there is a result for every household, filled in by one person for this household (the reference person). I am struggling with the following;
Some variables are individual variables and are differerent for each respondent, other variables are household variables and only one person (the reference person in a household) has answered these. Now my problem is that the household variables contain less observations than the individual ones. The goal is to reshape the household variables into an individual variable. I thought about doing this by copying the household observation for the reference person to all other persons in that household. I was thinking about working with a foreach and to run through all households (via hhid (household id) and then duplicating if person is reference person (piid==1) and this the amount of times as the household is big (hhsize (household size). Unfortunately I am unable to figure out how to do this. An example of a household variable is V400908_2 which indicates how easy it is to reach a GP.
hhid=household id
hhsize=householdsize
piid= position in household (=1 for reference person)
Thanks for the help
Related Posts with Duplicate observations from group to individual level
Tip with recoding 40+ values in a variableHi! I am new to STATA and I am trying to recode a variable with 40 values. For values 1 to 38, i wan…
Which model to chooseHello Im doing my research aiming to study the effects of different demographics on the Self employm…
Running Sum MatrixHello, I am new to Mata and how do you calculate a running sum matrix? …
How to do a correlation coefficients forest plot with Random-Effects Approach? Dear Statalist I really need your help to correct and run code. I'm currently working on meta-…
testing coefficient equality across modelsDear All, Suppose that I estimate the following two regressions: Code: webuse grunfeld, clear gen …
Subscribe to:
Post Comments (Atom)
0 Response to Duplicate observations from group to individual level
Post a Comment