We know from the survey that the right variables to answer this question are "migrate" and "house_c". However, both variables contain invalid negative numbers, so we need to get rid of those to get any sensible numbers. So first of all, we might want to enter:
replace migrate=. if migrate<0
replace house_c=. if house_c<0
Now we want a table of percentages, calculated with the number of people living in traditional dwellings in the denominator. To get this, enter:
tab migrate house_c, column
13 |
:migrated |
during | 1 :code:type of house
past 5 yrs | 01-shack 02-house 03-tradi 04-maiso 05-flat | Total
-----------+-------------------------------------------------------+----------
1 | 48 192 29 8 23 | 347
| 9.82 7.26 3.73 16.33 14.65 | 6.77
-----------+-------------------------------------------------------+----------
2 | 441 2454 748 41 134 | 4777
| 90.18 92.74 96.27 83.67 85.35 | 93.23
-----------+-------------------------------------------------------+----------
Total | 489 2646 777 49 157 | 5124
| 100.00 100.00 100.00 100.00 100.00 | 100.00
13 |
:migrated |
during | 1 :code:type of house
past 5 yrs | 06-hoste 07-outbu 08-combi 09-other | Total
-----------+--------------------------------------------+----------
1 | 14 15 18 0 | 347
| 26.42 27.78 2.01 0.00 | 6.77
-----------+--------------------------------------------+----------
2 | 39 39 877 4 | 4777
| 73.58 72.22 97.99 100.00 | 93.23
-----------+--------------------------------------------+----------
Total | 53 54 895 4 | 5124
| 100.00 100.00 100.00 100.00 | 100.00
3.73% of people who live in traditional dwellings have moved in the last five years.