I want a bar chart to show the percentage of observations with each of nine different values (0 to 8) in four groups of patients.
This code shows the number of patients (i e, frequency) with each of these values in each of the four groups (see attached fig):
This code shows the percentage (see attached fig):
But it is obvious that the percentage is calculated with the entire patient cohort (i e, all four groups) as the denominator.
How do I get the percentage within each patient group?
I have tried the graphics menu and selected the option "Graph of percent of frequencies within categories", but that is apparently not what I get?
Thanks for any advice
This code shows the number of patients (i e, frequency) with each of these values in each of the four groups (see attached fig):
Code:
graph bar (count), over(value) over(Pt_group) bargap(10)
Code:
graph bar, over(value) over(Pt_group)
How do I get the percentage within each patient group?
I have tried the graphics menu and selected the option "Graph of percent of frequencies within categories", but that is apparently not what I get?
Thanks for any advice
Comment