Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Help with graph bar

From   "Svend Juul" <SJ@SOCI.AU.DK>
To   <>
Subject   Re: st: Help with graph bar
Date   Wed, 30 Nov 2005 14:47:40 +0100

Ilaria wrote:

I have five different variables (calculated as percentages), and namely:
the % of the population living within 15 minutes distance from a
hospital, the % of population living within 30 minutes distance from a
hospital, ... within 45 min..., ... within 60 min..., and over 60 min.

The hospitals are classified into 5 categories, like general hospital,
university hospital, and so forth.

I would like to draw a graph bar showing the percentages of the
population "w\in15 w\in30 w\in45 w\in60 over60 minutes" as the yvars for
the different five categories of hospitals.

I typed in the following command:
Graph bar w\in15 w\in30 w\in45 w\in60 over60, perc by (category)
But I get an error report saying that the option by is not allowed. What
is the right command?

Moreover, I have some further questions:
1. Being the vbs w\in15 w\in30 w\in45 w\in60 over60 already percentages,
should I specify anyway the option per? Alternatively, should I use the
"original" values and let stata calculate the percentages while drawing
the graph?
2. Is there any other graph I could use for this purpose?


Look at the online help:
    help graph bar
It tells nothing about a -by()- option; probably the -over()- option is
what you need. Next: avoid a space between the option name and the
parenthesis. Write -over(category)-, not -over (category)-. A space here
may give some spectacular error messages.

I guess that your variable names are different from what you show us; at
least my Stata does not accept -w\in15- as a variable name.

With distances at an ordinal (rank) scale you might want to display
stacked bars; a bar for each hospital type. Here is an example:

generate x=1
graph bar (count) x                            ///
   ,                                            ///
   over(rep78) over(foreign)                    ///
   asyvars percent stack                        ///
   bar(1, fcolor(gs0))                          ///
   bar(2, fcolor(gs6))                          ///
   bar(3, fcolor(gs10))                         ///
   bar(4, fcolor(gs13))                         ///
   bar(5, fcolor(gs16))                         ///
   legend(title("Repair" "record" , size(*0.8)) ///
     order(5 4 3 2 1))                          ///
   ytitle("Per cent")                           ///

Hope this helps


Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796

*   For searches and help try:

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