Hello Statalist,
I am a new Stata user (using Stata 15). I am attempting to graph the frequencies within a category with 2 different variables on one bar graph.
I have variable "pindeye" which has 5 possible results. "pindeye" was measured over two years: 2018 and 2019 (variable year). Without actually splitting the data, I was wondering if it is possible to graph the frequencies of the 5 possible results of "pindeye" for 2018 and again for 2019, but to combine these on one graph.
This gives me the following, which displays the correct data, but not overlapping

This gives me the visual representation I am attempting to achieve, but gives me the wrong data (it gives the overall frequency within the category of variable "pindeye" (it doesn't allow for calculating frequency separately for 2018 and 2019)

I understand a simple fix for this would be to split the data for 2018 and 2019 into their own variables, but as I have many variables beyond "pindeye" that I am testing, I feel like that would be somewhat time consuming. I have searched the forums and reviewed the manuals I have access to and haven't found a command line combination to achieve the above goal. I appreciate any assistance with this. Thank you!
I am a new Stata user (using Stata 15). I am attempting to graph the frequencies within a category with 2 different variables on one bar graph.
I have variable "pindeye" which has 5 possible results. "pindeye" was measured over two years: 2018 and 2019 (variable year). Without actually splitting the data, I was wondering if it is possible to graph the frequencies of the 5 possible results of "pindeye" for 2018 and again for 2019, but to combine these on one graph.
. graph bar, by(year) over(pindeye) asyvars bar(1, bfcolor(blue*0.5)) bar(2, bfcolor(green*0.5))
graph bar, over(year) over(pindeye) asyvars bar(1, bfcolor(blue*0.5)) bar(2, bfcolor(green*0.5))
I understand a simple fix for this would be to split the data for 2018 and 2019 into their own variables, but as I have many variables beyond "pindeye" that I am testing, I feel like that would be somewhat time consuming. I have searched the forums and reviewed the manuals I have access to and haven't found a command line combination to achieve the above goal. I appreciate any assistance with this. Thank you!
Comment