Hello,

I have a categorical variable for ethnicity.

When I tabulate it I can see that there are percentages assigned to each one. I want to create a new variable called availability ratio which is basically= number of people belonging to ethnicity A over total population (i.e. it's the percentage that I see when I use the tab command).

I used the following command:

egen avail_ratio=pc(ethnicity)

but it doesn't work. It doesn't give me the right percentages.

Could somebody correct my command please?