Search code examples
stata

Creating a % from two categorical variables (Stata)


I have two variables, one is labor market status and it is listed as a count of people in each category:

LF_status      Freq. 

In_LF           100
Out_of_LF       20

And then an education categorical variable with the following groups:

educ                     Freq. 
no_HS                    30 
HS but not college       80
College                  10

I would like to visualize labor force participation as a % in each group. For instance, what % of those with a college degree are in the labor force, rather than using frequencies/counts. Essentially, I would like to know how labor force participation varies by one's education.

Currently my code is this and it produces something similar to the graph below:

graph hbar (count), over(lm_stat) over(educ) 

enter image description here


Solution

  • A community-contributed wrapper for graph hbar is catplot from SSC.

    sysuse auto, clear 
    catplot rep78 foreign, percent(foreign) 
    

    is a simple example.