Re: st: Bar graph ordered by values of yvar

 From "Friedrich Huebler" To statalist@hsphsun2.harvard.edu Subject Re: st: Bar graph ordered by values of yvar Date Thu, 13 Mar 2008 19:09:26 -0400

```David,

Here is one solution.

. sysuse nlsw88, clear
. foreach var of varlist hours wage tenure {
sum `var' if collgrad == 0
gen ncg`var' = r(mean)
sum `var' if collgrad == 1
gen cg`var' = r(mean)
}
. keep in 1
. graph hbar ncghours - cgtenure, ascategory

Friedrich

On Thu, Mar 13, 2008 at 6:34 PM, David Radwin <radwin@berkeley.edu> wrote:
> Dear Stata-listers,
>
>  I have a question analogous to one I asked last year that was
>  graciously answered by Nick Cox
>  (http://www.stata.com/statalist/archive/2007-08/msg00934.html).
>
>  Rather than pose the question outright, I will illustrate with a
>
>  . sysuse nlsw88, clear
>  . graph hbar (mean) hours wage tenure, over(collgrad) showyvars
>
>  give you a graph with the bars in the order, from top to bottom, of:
>
>  1. mean hours for non-college grads
>  2. mean wage for non-college grads
>  3. mean tenure for non-college grads
>  4. mean hours for college grads
>  5. mean wage for college grads
>  6. mean tenure for college grads
>
>  But what I actually want is
>
>  1. mean hours for non-college grads
>  2. mean hours for college grads
>  3. mean wage for non-college grads
>  4. mean wage for college grads
>  5. mean tenure for non-college grads
>  6. mean tenure for college grads
>
>  Is there a option, user-written program, or set of commands that
>  would produce this graph?
>
>  David
>  --