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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Σχετ: st: Σχετ: st: Combine stacked and unstacked bars


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Σχετ: st: Σχετ: st: Combine stacked and unstacked bars
Date   Wed, 21 Dec 2011 15:46:15 +0000

You can add another -over()- option or a -by()- option then.

By the Greek characters in your posts may cause small problems for many readers.

Nick

On 21 Dec 2011, at 15:30, Nikolaos Kanellopoulos <nkkanel@yahoo.gr> wrote:

Sorry for the double posting but by mistake I sent my previous email without finishing it.

Thanks Nick, but this is not exactly what I want.
In my first email when I wrote I want two bars I meant two bars per idcode.

Thanks a lot
Nikos


----- Αρχικό μήνυμα -----
Απο: Nikolaos Kanellopoulos <nkkanel@yahoo.gr>
Προς: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Κοιν.:
Στάλθηκε: 5:01 μ.μ. Τετάρτη, 21 Δεκεμβρίου 2011
Θεμα: st: Σχετ: st: Combine stacked and unstacked bars

Nick,

thanks a lot.

Nikos
----- Αρχικό μήνυμα -----
Απο: Nick Cox <njcoxstata@gmail.com>
Προς: statalist@hsphsun2.harvard.edu
Κοιν.:
Στάλθηκε: 4:47 μ.μ. Τετάρτη, 21 Δεκεμβρίου 2011
Θεμα: Re: st: Combine stacked and unstacked bars

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

Nick

2011/12/21 Nikolaos Kanellopoulos <nkkanel@yahoo.gr>:

I searched the Statalist archives and the web and could not find an answer to my question. I am sorry if this question has been posted before and skipped my attention.

I have three variables over a period of ten years and I want to create a graph bar with two of them stacked over each other and the third next to them.

For instance in the following simple example:

webuse union, clear
keep idcode year age
reshape wide age, i( idcode) j( year)
keep in 1/10
graph bar  age71 age77 age88, over(idcode)

I want two bars. The first will be age71 age77 stacked together and the second

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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