I would like to generate variable to figure out the education level of father and mother.
I do not know what is the best code for this.
The problem is the variable that show the relationship with household includes variety of relationship.
The problem is the relationsip is like household and spouse rather than father and mother
The variables are as follows and the values for rel_hh(relationship with household) and hig_edu(the level of highest education) are below.
I wanna generate variables like below
father's edu and mother's edu for each household or person if possible.
How can I deal with this?
clear
input long(hhid persid) byte(sex rel_hh hig_edu)
100101 10010104 1 4 6
100101 10010103 1 3 11
100101 10010105 1 5 0
100101 10010101 0 1 14
100101 10010102 1 2 13
100102 10010201 0 1 6
100102 10010203 0 3 17
100102 10010204 0 3 14
100102 10010202 1 2 3
100103 10010304 0 3 8
100103 10010303 0 3 14
100103 10010305 1 3 .
100103 10010301 0 1 8
100103 10010302 1 2 4
100104 10010404 0 8 .
100104 10010402 1 3 10
100104 10010403 0 10 14
100104 10010401 1 1 4
100105 10010506 1 3 10
100105 10010505 1 3 17
100105 10010504 1 3 7
100105 10010507 0 3 5
100105 10010502 1 2 6
100105 10010501 0 1 4
100105 10010503 1 3 7
100106 10010603 0 3 4
100106 10010604 0 3 2
100106 10010601 0 1 7
100106 10010602 1 2 7
100106 10010605 0 3 .
100107 10010703 0 3 9
100107 10010702 0 3 7
100107 10010701 1 1 3
100108 10010801 1 1 3
100108 10010802 0 3 3
100109 10010901 0 1 8
100109 10010904 0 3 7
100109 10010902 1 2 4
100109 10010905 1 3 6
100109 10010903 0 3 8
100109 10010906 1 3 0
100110 10011002 0 3 14
100110 10011001 0 1 3
100111 10011104 0 3 .
100111 10011102 1 2 11
100111 10011103 1 3 0
100111 10011101 0 1 14
100112 10011203 1 3 14
100112 10011205 0 3 3
100112 10011201 0 1 6
100112 10011202 1 2 10
100112 10011204 1 3 9
100201 10020105 1 8 .
100201 10020104 0 10 9
100201 10020102 1 2 8
100201 10020101 0 1 8
100201 10020103 1 3 11
100202 10020203 0 8 10
100202 10020201 1 1 .
100202 10020202 0 3 .
100202 10020204 1 8 6
100203 10020305 0 8 4
100203 10020302 1 2 .
100203 10020301 0 1 4
100203 10020306 0 8 88
100203 10020307 0 8 .
100203 10020304 1 3 13
100203 10020303 0 3 6
100204 10020403 1 3 3
100204 10020402 1 2 4
100204 10020404 1 3 6
100204 10020401 0 1 3
100205 10020502 0 2 .
100205 10020508 1 8 .
100205 10020507 0 8 .
100205 10020505 1 3 5
100205 10020506 0 10 .
100205 10020501 1 1 .
100205 10020503 0 3 7
100205 10020504 1 3 .
100206 10020605 1 3 .
100206 10020602 1 2 6
100206 10020603 0 3 10
100206 10020601 0 1 8
100206 10020604 0 3 6
100207 10020701 0 1 .
100207 10020702 1 2 7
100208 10020802 1 3 6
100208 10020801 0 1 8
100209 10020903 0 3 7
100209 10020902 1 3 5
100209 10020901 1 1 7
100210 10021005 0 3 7
100210 10021003 0 3 9
100210 10021002 1 2 .
100210 10021006 1 8 .
100210 10021004 0 3 9
100210 10021001 0 1 .
100211 10021102 0 7 .
100211 10021103 0 8 7
end
[/CODE]
CATEGORIES
I do not know what is the best code for this.
The problem is the variable that show the relationship with household includes variety of relationship.
The problem is the relationsip is like household and spouse rather than father and mother
The variables are as follows and the values for rel_hh(relationship with household) and hig_edu(the level of highest education) are below.
I wanna generate variables like below
father's edu and mother's edu for each household or person if possible.
How can I deal with this?
clear
input long(hhid persid) byte(sex rel_hh hig_edu)
100101 10010104 1 4 6
100101 10010103 1 3 11
100101 10010105 1 5 0
100101 10010101 0 1 14
100101 10010102 1 2 13
100102 10010201 0 1 6
100102 10010203 0 3 17
100102 10010204 0 3 14
100102 10010202 1 2 3
100103 10010304 0 3 8
100103 10010303 0 3 14
100103 10010305 1 3 .
100103 10010301 0 1 8
100103 10010302 1 2 4
100104 10010404 0 8 .
100104 10010402 1 3 10
100104 10010403 0 10 14
100104 10010401 1 1 4
100105 10010506 1 3 10
100105 10010505 1 3 17
100105 10010504 1 3 7
100105 10010507 0 3 5
100105 10010502 1 2 6
100105 10010501 0 1 4
100105 10010503 1 3 7
100106 10010603 0 3 4
100106 10010604 0 3 2
100106 10010601 0 1 7
100106 10010602 1 2 7
100106 10010605 0 3 .
100107 10010703 0 3 9
100107 10010702 0 3 7
100107 10010701 1 1 3
100108 10010801 1 1 3
100108 10010802 0 3 3
100109 10010901 0 1 8
100109 10010904 0 3 7
100109 10010902 1 2 4
100109 10010905 1 3 6
100109 10010903 0 3 8
100109 10010906 1 3 0
100110 10011002 0 3 14
100110 10011001 0 1 3
100111 10011104 0 3 .
100111 10011102 1 2 11
100111 10011103 1 3 0
100111 10011101 0 1 14
100112 10011203 1 3 14
100112 10011205 0 3 3
100112 10011201 0 1 6
100112 10011202 1 2 10
100112 10011204 1 3 9
100201 10020105 1 8 .
100201 10020104 0 10 9
100201 10020102 1 2 8
100201 10020101 0 1 8
100201 10020103 1 3 11
100202 10020203 0 8 10
100202 10020201 1 1 .
100202 10020202 0 3 .
100202 10020204 1 8 6
100203 10020305 0 8 4
100203 10020302 1 2 .
100203 10020301 0 1 4
100203 10020306 0 8 88
100203 10020307 0 8 .
100203 10020304 1 3 13
100203 10020303 0 3 6
100204 10020403 1 3 3
100204 10020402 1 2 4
100204 10020404 1 3 6
100204 10020401 0 1 3
100205 10020502 0 2 .
100205 10020508 1 8 .
100205 10020507 0 8 .
100205 10020505 1 3 5
100205 10020506 0 10 .
100205 10020501 1 1 .
100205 10020503 0 3 7
100205 10020504 1 3 .
100206 10020605 1 3 .
100206 10020602 1 2 6
100206 10020603 0 3 10
100206 10020601 0 1 8
100206 10020604 0 3 6
100207 10020701 0 1 .
100207 10020702 1 2 7
100208 10020802 1 3 6
100208 10020801 0 1 8
100209 10020903 0 3 7
100209 10020902 1 3 5
100209 10020901 1 1 7
100210 10021005 0 3 7
100210 10021003 0 3 9
100210 10021002 1 2 .
100210 10021006 1 8 .
100210 10021004 0 3 9
100210 10021001 0 1 .
100211 10021102 0 7 .
100211 10021103 0 8 7
end
[/CODE]
1 | Head | 3840 | ![]() |
2 | Spouse | 3046 | ![]() |
3 | Son/Daughter | 7815 | ![]() |
4 | Stepchild | 39 | ![]() |
5 | Adopted child/Foster child | 16 | ![]() |
6 | Parent | 109 | ![]() |
7 | Sibling | 130 | ![]() |
8 | Grand child | 1186 | ![]() |
9 | Nephew/Niece | 112 | ![]() |
10 | Son/Daughter-in-law | 569 | ![]() |
11 | Brother/Sister-in-law | 86 | ![]() |
12 | Parent-in-law | 161 | ![]() |
13 | Other relatives | 95 | ![]() |
14 | Servant | 4 | ![]() |
15 | Other non-relative including boarder | 17 | ![]() |
CATEGORIES
0 | Pre-school/Kindergarten | 238 | ![]() |
1 | Class 1 completed | 630 | ![]() |
2 | Class 2 completed | 972 | ![]() |
3 | Class 3 completed | 1352 | ![]() |
4 | Class 4 completed | 1516 | ![]() |
5 | Class 5 completed | 1530 | ![]() |
6 | Class 6 completed | 1229 | ![]() |
7 | Class 7 completed | 1350 | ![]() |
8 | Class 8 completed | 1060 | ![]() |
9 | Class 9 completed | 717 | ![]() |
10 | Class 10 completed | 577 | ![]() |
11 | Class 11 completed | 425 | ![]() |
12 | Class 1 2 completed | 292 | ![]() |
13 | Lower education certificate (diploma) | 382 | ![]() |
14 | Higher education certificate (BacII) | 703 | ![]() |
15 | Technical/vocational pre-secondary diploma/certificate | 50 | ![]() |
16 | Technical/vocational post-secondary diploma/certificate | 30 | ![]() |
17 | College/university undergraduate | 47 | ![]() |
18 | Bachelor degree (B.A., BSc, etc.) | 377 | ![]() |
19 | Masters degree (M.A., MSc, etc) | 15 | ![]() |
20 | Doctorate degree (PhD) | 5 | ![]() |
21 | Other | 0 | ![]() |
88 | No class completed | 290 | ![]() |
98 | Don“t know | 0 | |
Sysmiss | 2967 |
Comment