Dear Statalist.

I would like help to generate a variable, say level of education "educ" for the male partner and female partner in a union (either married or de facto). Sample from panel dataset includes data for respondent (hgsex mrcurr edhigh1) and their partner (p_hgsex p_mrcurr p_edhigh1) hgsex == 1 (male) == 2 (female) mrcurr == 1 (married) == 2 (de facto).

Help appreciated.
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(hgsex p_hgsex mrcurr p_mrcurr edhigh1 p_edhigh1) 
1 2 1 1 5 9
2 1 2 2 8 9
2 1 2 2 8 9
2 1 1 1 5 5
2 1 2 2 5 5
2 1 2 2 9 9
1 2 1 1 9 9
1 2 1 1 9 9
2 1 1 1 1 3
2 1 1 1 1 3
2 1 2 2 9 4
2 1 2 2 9 4
1 2 1 1 5 5
1 2 1 1 5 5
1 2 1 1 5 8
1 2 1 1 5 5
1 2 1 1 5 8
1 2 1 1 5 5
1 2 1 1 5 8
1 2 1 1 3 3
1 2 1 1 3 3
1 2 2 2 3 4
1 2 1 1 3 3
1 2 1 1 3 3
1 2 2 2 3 8
1 2 1 1 3 3
1 2 1 1 3 3
1 2 2 2 8 8
2 1 1 1 4 3
2 1 1 1 4 1
2 1 1 1 4 1
2 1 1 1 4 3
2 1 1 1 4 1
end
Array