Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73262

How to create a percentage variable

$
0
0
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?

Viewing all articles
Browse latest Browse all 73262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>