I am trying to make a stacked bar graph but having some trouble. I have three groups of observations: "random women", "random men", and "male partners" and several conditions (I kept c1, c2, and c3 in the sample data), each observation answer "more" "fewer", or "fixed" for each condition.
The main problem is to get the conditions into the mix. I don't have a "condition" variable, so I don't know really how to put this into the graph hbar command.
The ideal is to have a grouped percentage bar graph similar to this, with bars grouped by three rather than two, and conditions on the left being the c1, c2, c3, etc.:
Array
I am using Stata MP 16.0.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(c1 c2 c3 group) 2 3 3 2 3 2 3 2 3 3 3 2 2 2 3 2 3 3 3 2 3 3 3 0 1 3 3 0 2 2 3 0 3 3 3 0 3 3 3 0 3 3 3 0 2 3 3 0 2 2 2 0 2 2 3 0 3 3 3 0 2 3 3 0 2 3 3 0 3 3 1 0 3 3 3 0 2 3 3 1 2 3 3 1 2 3 3 1 2 2 2 1 3 3 3 1 2 2 3 1 2 3 3 1 3 3 3 1 3 3 3 1 3 3 3 1 2 3 3 1 end label values c1 number label values c2 number label values c3 number label def number 1 "More", modify label def number 2 "Fewer", modify label def number 3 "Fixed", modify label values group groupl label def groupl 0 "Random Women", modify label def groupl 1 "Random Men", modify label def groupl 2 "Male Partner", modify
0 Response to Grouped Percentage Bar Graph
Post a Comment