Good evening,
I have a binary variable (outcome) and an explanatory categorical variable (cat). I need to create a bar graph with the percentage of "1's" of <outcome> in each category of <cat>.
I tried to use graph bar and catplot (Cox, N) without success. I always get a graph with the percentage of both the "0's" and the "1's" in each category of <cat>, using this command:
catplot outcome cat, fraction(cat) recast(bar)
How can I get rid of the percentage of 0's in each category of <cat>, without having to remodel the dataset with a "collapse" strategy?
I am using Stata v12.1.
Best regards, and many thanks in advance.
Filipe S. Paula
I have a binary variable (outcome) and an explanatory categorical variable (cat). I need to create a bar graph with the percentage of "1's" of <outcome> in each category of <cat>.
I tried to use graph bar and catplot (Cox, N) without success. I always get a graph with the percentage of both the "0's" and the "1's" in each category of <cat>, using this command:
catplot outcome cat, fraction(cat) recast(bar)
How can I get rid of the percentage of 0's in each category of <cat>, without having to remodel the dataset with a "collapse" strategy?
I am using Stata v12.1.
Best regards, and many thanks in advance.
Filipe S. Paula
Comment