EXERCISE 3 - ANSWER

Create a table and a pie graph showing occupation categories for the males in the survey.

First, enter the following command to create the dummy variables for occupation group occgrp:

tab k_occ_c if gender_c=="M", gen(occgrp)

This will generate the following table:

3a:code:occ |
    upation |      Freq.      Percent       Cum.
------------+-----------------------------------
         -4 |          1         0.27       0.27
   01-profe |         44        12.02      12.30
   02-manag |         16         4.37      16.67
   03-cleri |         25         6.83      23.50
   04-trans |         37        10.11      33.61
   05-servi |         37        10.11      43.72
   06-farmi |         19         5.19      48.91
   07-artis |         35         9.56      58.47
   08-produ |         14         3.83      62.30
   09-opera |         36         9.84      72.13
   10-labou |        102        27.87     100.00
------------+-----------------------------------
      Total |        366       100.00

As there are ten categories of occupations for males and one category for invalid responses, this will create a total of twelve dummy variables (occgrp1, occgrp2,...,occgrp12). To see these variables, just scroll down to the bottom in the "Variables" window.

Second, enter the following command to create the pie graph:

graph occgrp1 occgrp2 occgrp3 occgrp4 occgrp5 occgrp6 occgrp7 occgrp8 occgrp9 occgrp10 occgrp11, pie

This will create the following pie graph:

 

BACK TO EXERCISE QUESTIONS