(sum) x y
produces a graph of the sum of x and the mean of y. Perhaps what you
want is equivalent
to this dopey example using the auto data
graph hbar (sum) length (sum) weight, over(foreign) asyvars stack
over(rep78)
I used -hbar- to make this example legible and in illustration of my
prejudice that most bar charts are better off as horizontal, but the
same point holds for -bar-.
If you don't want sums for the two variables stacked on each other, you
probably need to -reshape long- your data and use another -over()-
option.
"doesn't work" is, by the way, not clear in itself. I have an ongoing
document based on Statalist postings which distinguishes about 20
different senses of "doesn't work".
In particular,
graph hbar (sum) length weight, over(foreign) asyvars stack over(rep78)
is utterly legal and produces a graph. So, it seems that "doesn't work"
means "does not do what I want" in your case. Your question sounds a
good one but please make quite clear what the issue is.
Nick
[email protected]
moleps islon
EVerything is fine and dandy as long as I only need X OR Y stacked byP
categorized by Z in two different graphs. The trouble is when I need
both X AND Y stacked by P and categorised by Z in the same graph.
Maarten Buis
>> I need to create a bar graph containing 2 different summed
>> variables(X,Y) sorted by category (Z). However I also need the X,Y
>> variables to be stacked by variable P. I've tried graph bar (sum) x
>> y, over(P) asyvars stack over(Z) and different variations over this
>> theme but none of them seem to work. Any ideas?
>
> See:
> http://www.stata.com/support/faqs/graphics/gph/statagraphs.html
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/