Hi,

I have a problem on constructing parents' education from the census data. The original variables are person ID, household ID, relationship (1=household head; 2=1's partner; 3=1's children; 5=1's parents), gender (1=male; 0=female), and schooling years. I would like to generate father's education and mother's education as shown in the last two columns. For example, for household 1 (row 1-3), we know person 3's parents' education. For household 2, we know person 4's mother's education.

How can I generate the last two columns?

Thanks,
Chris


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int(person house) byte(relation sex) float(eduy eduf edum)
1 1 1 1 16  .  .
2 1 2 0 12  .  .
3 1 3 0 12 16 12
4 2 1 1 15  .  3
5 2 2 0 15  .  .
6 2 5 0  3  .  .
end