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?
Related Posts with How to create a percentage variable
Expand value within groupDear all, I am currently working on a patient consultations database from 2016 to 2021. My purpose …
What's the principle behind twoway graph's legend and its label optionDear Stata users, I have an interesting finding regards to twoway graph's legend option, put it pre…
Problem with stcox hazard modelHi all, I am trying to use stcox to create a multivariable cox proportional hazard model. I am runni…
Trend analysisI am interested in comparing a linear trend model with 1) power trend, 2) exponential trend, and 3) …
Trouble with nested option in synthHi all, I am trying to use the user-contributed synth to estimate with synthetic control method. I a…
Subscribe to:
Post Comments (Atom)
0 Response to How to create a percentage variable
Post a Comment