Hello,
I have two variables with the same categories (5 point Likert scale). I'd like to create a horizontal bar chart (stacked) that presents the distribution of responses into the 5 categories for both variables, with the bars for both variables presented above each other.
I have already created separate variables for each category of the answer options, and I am able to create the bar chart for 1 variable witht the following code:
This leads to the following graph:



What I need is something like the following (different example, but same idea -- 2 variables with the same categories and 1 legend + variable labels):

The variables of the categories for the second variable are named:
Thanks in advance!
I have two variables with the same categories (5 point Likert scale). I'd like to create a horizontal bar chart (stacked) that presents the distribution of responses into the 5 categories for both variables, with the bars for both variables presented above each other.
I have already created separate variables for each category of the answer options, and I am able to create the bar chart for 1 variable witht the following code:
Code:
graph hbar (sum) s_dis_force dis_force neutr_force agr_force s_agr_force, /// bar(1, color(red)) bar(2, color(red*0.5)) /// bar(3, color(gs8)) bar(4, color(green*0.5)) /// bar(5, color(green)) /// legend(label(1 "Strongly disagree") label(2 "Disagree") /// label(3 "Neutral") label(4 "Agree") label(5 "Strongly agree") /// size(small) order(1 2 3 4 5) rows(1) position(6)) /// stack percent ytitle("%", orientation(horizontal))
What I need is something like the following (different example, but same idea -- 2 variables with the same categories and 1 legend + variable labels):
The variables of the categories for the second variable are named:
Code:
s_dis_important dis_important neutr_important s_agr_important agr_important
Comment