Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: bar graph question
From
Scott Merryman <[email protected]>
To
[email protected]
Subject
Re: st: bar graph question
Date
Sat, 20 Feb 2010 17:56:52 -0600
You could use Nick's -catplot-
sysuse auto,clear
label define rep 1 "Excellent" 2 "Very Good" 3 "Acceptable" 4 "Poor" 5 "Failing"
label values rep78 rep
catplot bar rep78, percent
Also, of possible interest:
http://www.stata.com/support/faqs/data/percentvars.html
Scott
On Sat, Feb 20, 2010 at 3:17 PM, Jeph Herrin <[email protected]> wrote:
>
> I have a categorical variable, -var-, which takes 5 values.
> I would like a bar graph which has a bar representing the %
> in each category. Eg, if this is my variable
>
> var1 | Freq. Percent Cum.
> ------------+-----------------------------------
> Excellent | 278 24.26 24.26
> Very Good | 526 45.90 70.16
> Acceptable | 282 24.61 94.76
> Poor | 54 4.71 99.48
> Failing | 6 0.52 100.00
> ------------+-----------------------------------
> Total | 1,146 100.00
>
>
> I would like the graph to have the first bar labelled Excellent
> and be 24% high; the second labelled "Very Good" and be 46% high,
> etc. Five bars.
>
> I know I can get there by collapsing or reshaping the data, but
> it seems like this should be a trivial graph to produce directly.
> If so, how? If not, why not?
>
> thanks,
> Jeph
>
*
* 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/