Using egen, we want to create a variable that has responses for the different races and the different relationships to the head of the household. Similar to how it was done in the original egen group exercise, type:
egen sdrace=group(race rel_head)
At this point, we can run a cross tab of rel_head on race to see how many sons and daughters are African.
3 |
:relations |
hip to | 19 :population group
head | 01-afric 02-colou 03-india 04-white | Total
-----------+--------------------------------------------+----------
01-resid | 660 70 24 133 | 887
02-absen | 92 4 0 2 | 98
03-wife | 416 59 24 103 | 602
04-son o | 1913 192 50 165 | 2320
05-fathe | 39 1 5 4 | 49
06-grand | 697 41 5 3 | 746
07-grand | 2 0 0 1 | 3
08-mothe | 3 2 0 1 | 6
09-son- | 47 3 2 1 | 53
10-broth | 19 3 0 1 | 23
11-aunt | 5 1 0 0 | 6
12-siste | 114 7 2 1 | 124
13-niece | 101 10 2 0 | 113
14-cousi | 14 8 0 0 | 22
16-house | 9 3 2 17 | 31
17-lodge | 2 0 0 1 | 3
18-other | 43 2 3 0 | 48
19-other | 6 1 0 3 | 10
-----------+--------------------------------------------+----------
Total | 4182 407 119 436 | 5144
There are 1913 sons or daughters who are African. Now looking at the tabulation of sdrace, one sees that this variable is coded as 4. sdrace, one sees that this variable is coded as 4.
group(race |
rel_head) | Freq. Percent Cum.
------------+-----------------------------------
1 | 660 12.83 12.83
2 | 92 1.79 14.62
3 | 416 8.09 22.71
4 | 1913 37.19 59.90
5 | 39 0.76 60.65
6 | 697 13.55 74.20
7 | 2 0.04 74.24
8 | 3 0.06 74.30
9 | 47 0.91 75.21
10 | 19 0.37 75.58
11 | 5 0.10 75.68
12 | 114 2.22 77.90
13 | 101 1.96 79.86
14 | 14 0.27 80.13
15 | 9 0.17 80.31
16 | 2 0.04 80.35
17 | 43 0.84 81.18
18 | 6 0.12 81.30
19 | 70 1.36 82.66
20 | 4 0.08 82.74
21 | 59 1.15 83.88
22 | 192 3.73 87.62
------------+-----------------------------------
Total | 5144 100.00 100.00
So now it is possible to run a cross tab of sdrace and migrate.
tab sdrace migrate
group(race | 13 :migrated during past 5 yrs
rel_head) | -1 1 2 | Total
-----------+---------------------------------+----------
1 | 1 61 598 | 660
2 | 0 9 83 | 92
3 | 1 32 383 | 416
4 | 3 82 1828 | 1913
5 | 0 2 37 | 39
6 | 10 11 676 | 697
7 | 0 1 1 | 2
8 | 0 0 3 | 3
9 | 0 4 43 | 47
10 | 0 2 17 | 19
11 | 0 1 4 | 5
12 | 0 14 100 | 114
13 | 0 7 94 | 101
14 | 0 1 13 | 14
15 | 0 3 6 | 9
16 | 0 1 1 | 2
17 | 0 3 40 | 43
18 | 0 0 6 | 6
19 | 0 2 68 | 70
20 | 0 0 4 | 4
21 | 0 1 58 | 59
22 | 0 2 190 | 192
23 | 0 0 1 | 1
-----------+---------------------------------+----------
Total | 15 347 4782 | 5144
So the answer is 82 people who are African sons or daughters have migrated in the last five years.