I want to figure out what percentage of African American and hispanic people work when the value of the SOC2 variable ==11 sorted by county, month, and year.
Should I do this the following way?
This is an example of my data.
Should I do this the following way?
Code:
bys county month year: egen blackhispan= total(cond(black, hispanic, soc2==11,.)) bys county month year: egen alltotal= total(soc2==11) gen wanted= blackhispan / alltotal
Code:
input int race float(black hispanic soc2) 100 0 0 53 200 1 0 43 100 0 0 47 100 0 0 43 100 0 0 43 100 0 0 11 100 0 0 . 100 0 0 47 200 1 0 47 100 0 0 25 100 0 0 11 200 1 0 43 200 1 0 41 200 1 0 . 200 1 0 37 100 0 1 53 100 0 0 53 100 0 0 49 100 0 0 41 200 1 0 41 100 0 0 51 200 1 0 . 100 0 0 35 100 0 0 11 100 0 1 51 100 0 0 49 100 0 0 43 100 0 0 35 200 1 0 47 100 0 0 53 100 0 0 11 100 0 0 43 100 0 0 35 100 0 0 33 100 0 0 . 100 0 0 11 100 0 0 . 100 0 0 47 100 0 0 . 100 0 0 25 200 1 0 53 100 0 0 29 100 0 0 41 200 1 0 53 200 1 0 53 200 1 0 25

Comment