From the following dataset:
I use this syntax:
To produce this graph:

Now, the purpose of the graph is to compare the mean value of each variable in the varlist for different years. For instance, I'd quickly like to see if var1 has decreased or increased from 2010 to 2011. Therefore, I would prefer to have the two bars representing var1 next to each other sorted on years and so on. In essence, it would be perfect to have the varlist variables on the x-axis and the years in the legend.
In addition, I want to see the exact values the bars are representing, as provided for with the blabel.
I hope this rather long example illustrates what I'd like to do, despite my inability to use the proper terminology. I've used several hours experimenting with different bar graph options (and also other kind of graphs), without much luck.
My real dataset consists of eight variables from the years 2005 to 2013. Usually I'd like to pick two or three different years, for instance 2006, 2009 and 2013, to get both a quick understanding of the trend, but also the detailed numbers from the blabel.
Code:
. list var1 var2 var3 Year in 10000/10001 var1 var2 var3 Year 10000. 142 239 4631 2010 10001. 132 194 4494 2011
Code:
. graph bar var1 var2 var3 if inlist(Year,2010,2011), /// over(Year) /// blabel(bar, format(%9.0f) size(small) position(base) ) /// blabel(total, format(%9.0f) ) /// legend( size(vsmall) cols(3) order(1 "var1" 2 "var2" 3 "var3" ))
Now, the purpose of the graph is to compare the mean value of each variable in the varlist for different years. For instance, I'd quickly like to see if var1 has decreased or increased from 2010 to 2011. Therefore, I would prefer to have the two bars representing var1 next to each other sorted on years and so on. In essence, it would be perfect to have the varlist variables on the x-axis and the years in the legend.
In addition, I want to see the exact values the bars are representing, as provided for with the blabel.
I hope this rather long example illustrates what I'd like to do, despite my inability to use the proper terminology. I've used several hours experimenting with different bar graph options (and also other kind of graphs), without much luck.
My real dataset consists of eight variables from the years 2005 to 2013. Usually I'd like to pick two or three different years, for instance 2006, 2009 and 2013, to get both a quick understanding of the trend, but also the detailed numbers from the blabel.
Comment