Support #1128
openHow to match husbands and wives in USoc without dropping one or the other
100%
Description
Dear Stephanie, it is me again. I need your help with the following. I try to match husbands and wives (spouses) in USoc. This is what I am doing which is based on a previous suggestion from your team quite a while ago.
*manipulate data set to find age, UK arrival year etc. of spouse (sppno)
sort hidp pno
gen partnum=cond(pno < sppno, pno, sppno) if sppno>0
drop if sppno == 0 | sppno<0
bysort hidp partnum: egen numinpart = sum(sppno > 0)
tab numinpart
keep if numinpart 2
bysort hidp partnum: ge sp_age = cond(_n2,age(1),age(2),.) /// where age brackets 1 and age brackets 2, i.e.[] if I place a number within brackets, I get a goofy preview.
if partnum<.
bysort hidp partnum: ge sp_yr2uk4 = cond(_n==2,yr2uk4(1),yr2uk4(2),.) /// where yr2uk4 brackets 1 and yr2uk4 brackets 2, i.e.[]
if partnum<.
bysort hidp partnum: drop if (sex==1 & _n==2) | (sex==1 & _n==1) // drop females (2) or males (1), here I drop males so all variables defined are for wives and all sp_variables are for husbands.
Unfortunately, for my research question, I need to have husbands and wives matched, have variable characteristics for say wives and sp_characteristics for husbands WITHOUT having the dropping procedure of the previous line (i.e., bysort hidp partnum: drop if (sex==1 & _n==2) | (sex==1 & _n==1)). I hope I am making sense, I need to match wives and husbands and generate characteristics of both without dropping wives or husbands. The data should look like this:
hidp education_wife education_husband age_wife age_husband etc.
1 postgrad bachelor 50 60 etc.
I hope this is clear, if not please feel free to ask me.
Once again, I would very much appreciate your help and support.
Best wishes from Manchester.
Nico