Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Bar graph ordered by values of yvar


From   "Friedrich Huebler" <[email protected]>
To   [email protected]
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 <[email protected]> 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
>  example comparing college graduates with non-college graduates:
>
>  . 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
>  --
>  David Radwin, Principal Analyst // [email protected]
>  Office of Student Research, University of California, Berkeley
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index