I am fairly new to Stata and the forum, I hope the way I described my problem is ok! Thank you so much in advance for reading and helping out
I have a battery of questions administered to parents (response options on a 7-point Likert scale) in 3 rounds (so at 3 different time points). I would like to display the percentages of each answer option across each round for all the questions in the same bar graph (for descriptive purposes and to give an overview). My problem is that I could not find a command that would fit all of my questions in one graph!
My data is stored in a long format, and I have the following variables:
Code:
ID, wave, recruitment_pathway, question1, question2, question3, question4, question5, question6, question7, question8, question9, question10
[ATTACH=CONFIG]temp_23569_1627482122756_484[/ATTACH]
I first tried to generate this graph by using the graph command, but this did not allow me to enter multiple variables.
Code:
graph hbar (count) if recruitment_pathway==1, over (question1) over(wave, label(labsize(vsmall))) percent stack asyvars bar(1, fcolor(dknavy) lcolor(dknavy)) bar(2, fcolor(emidblue) lcolor(emidblue)) bar(3, fcolor(eltblue) lcolor(eltblue)) bar(4, fcolor(teal) lcolor(teal)) bar(5, fcolor(erose) lcolor(erose)) bar(6, fcolor(lavender) lcolor(lavender)) bar(7, fcolor(purple) lcolor(purple)) legend(on colfirst cols(2) size(vsmall) color(black)) graph hbar (count) if recruitment_pathway==2, over (question1) over(wave, label(labsize(vsmall))) percent stack asyvars bar(1, fcolor(dknavy) lcolor(dknavy)) bar(2, fcolor(emidblue) lcolor(emidblue)) bar(3, fcolor(eltblue) lcolor(eltblue)) bar(4, fcolor(teal) lcolor(teal)) bar(5, fcolor(erose) lcolor(erose)) bar(6, fcolor(lavender) lcolor(lavender)) bar(7, fcolor(purple) lcolor(purple)) legend(on colfirst cols(2) size(vsmall) color(black))
Code:
ssc desc catplot ssc install catplot catplot question1 wave, percent(wave) by(recruitment_pathway) recast(hbar) asyvars stack legend(size(vsmall) color(black)) bar(1, fcolor(dknavy) lcolor(dknavy)) bar(2, fcolor(emidblue) lcolor(emidblue)) bar(3, fcolor(eltblue) lcolor(eltblue)) bar(4, fcolor(teal) lcolor(teal)) bar(5, fcolor(erose) lcolor(erose)) bar(6, fcolor(lavender) lcolor(lavender)) bar(7, fcolor(purple) lcolor(purple))
Laura
0 Response to Question on bar graph (percentages of answer options) by group for more than 3 variables
Post a Comment