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, 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 <>
Subject   st: Stacked and Unstacked Variables in Graph Bar
Date   Fri, 19 Apr 2013 20:16:52 +0200


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:

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