Statalist


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

Re: st: label in -graph bar-


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: label in -graph bar-
Date   Wed, 23 Sep 2009 06:10:42 -0500

In -relabel()-  the "# refers to category number, which is determined
by sorting the unique values of the
        variable (here sex) and assigning 1 to the first value, 2 to
the second, and so on" (from help file).

Note:

sysuse auto,clear
replace rep = rep +2003
tab rep
graph bar (mean) mpg, over(rep, ///
 relabel(2004 "2004-05" 2005 "2005-06" 2006 "2006-07" 2007  ///
  "2007-8" 2008 "2008-09" )) name(gr1, replace)

graph bar (mean) mpg, over(rep, ///
 relabel(1 "2004-05" 2 "2005-06" 3 "2006-07" 4 "2007-8" 5 "2008-09"))

Scott



On Tue, Sep 22, 2009 at 10:18 PM, Sue <[email protected]> wrote:
> I tried that already but it doesn't work:
>
>  foreach var in realloangrowth realdepositgrowth   {
>  local v1: variable label `var'
>  graph bar (mean) `var', label ///
>  over(year, relabel(2005 "2004-05" 2006 "2005-06" 2007 "2006-07" 2008
> "2007-08") ///
>  label(labsize(vsmall))) ytitle(`v1') ///
>  bargap(2) b1title("Year") by(ctype, title("`v1' by cgroup")) ///
>  /*graph export `var'_pre.png, replace*/
>  }

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index