Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Stacked and Unstacked Variables in Graph Bar


From   Hendrik Worschech <hendrik.worschech@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Stacked and Unstacked Variables in Graph Bar
Date   Fri, 19 Apr 2013 20:16:52 +0200

Hi,

I have a panel with, lets say, 10 individuals over 5 years and three
variables (a, b & c).

I would like to have the sum (of all individuals) of a & b stacked
together as one bar and the sum of c by itself next to it. And this
should be repeated for each year.

I've come across this example, but in my case I don't want to separate
by observations but by variables. I don't know how I could separate
the variables a&b from c with over:

webuse union, clear
keep idcode year age
gen which = cond(year == 71 | year == 77, 1, cond(year == 88, 2, .))
graph bar age, over(year) over(which) asyvars stack


Thank you for you help!
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index