Dear Stata users,
I am using a cross section database (SHARE) and I want to extract items answered by a person's spouse to include them in my model, but people only answer questions on themselves, but not about their spouse directly. Therefore I would like to transform the data in such a way that I can use the items form the spouse and look if answers provided by the spouse influence individuals.
For example as in:
y = explanatory variables + answer from spouse + controls + e
mergeid = person identifier
hhid5 = household identifier
ph005_ = variable of interest
In my screenshot I have highlighted an example. The household id (hhid5) is the same for these individuals, but the person identifier (mergeid) is not.
First, in order to create a spouse identifier I tried things such as:
gen spouse_id = cond(hhid5 ==hhid5[_n+1], mergeid[_n+1], .) without any succes.
In other words, how do I transform the data that the answer of ph005_ by person A can be used in the regression for person B (that is married to A)?
I hope I am clear in my description.
Thanks in advance.
I am using a cross section database (SHARE) and I want to extract items answered by a person's spouse to include them in my model, but people only answer questions on themselves, but not about their spouse directly. Therefore I would like to transform the data in such a way that I can use the items form the spouse and look if answers provided by the spouse influence individuals.
For example as in:
y = explanatory variables + answer from spouse + controls + e
mergeid = person identifier
hhid5 = household identifier
ph005_ = variable of interest
In my screenshot I have highlighted an example. The household id (hhid5) is the same for these individuals, but the person identifier (mergeid) is not.
First, in order to create a spouse identifier I tried things such as:
gen spouse_id = cond(hhid5 ==hhid5[_n+1], mergeid[_n+1], .) without any succes.
In other words, how do I transform the data that the answer of ph005_ by person A can be used in the regression for person B (that is married to A)?
I hope I am clear in my description.
Thanks in advance.
Comment