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

Re: st: Graph bar option "if" and "x-axis"


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: Graph bar option "if" and "x-axis"
Date   Tue, 20 Dec 2005 13:18:40 +0100

Mosca, Ilaria wrote:
> The variables x1 x2 x3 x4 x5 are dummies, and I would like to know the
> percentages according to "z".
> However, I also want to know the percentages of these variables
> according to "z" and "y" [graph bar x1 x2 x3 x x5,perc over(z)over (y)].
> "Y" however is a continuous variables that can take the value from 1 to
> n. What I'd like to do is to specify that I want a graph bar over "z"
> and "y" when "y" is, for instance, equal to 1, 2, 3, ...
> Is it possible to do so?

Not quite sure what you want. What's wrong with 

. graph bar x1 x2 x3 x4 x5, perc over(z) over(y)

Probably you want to group y in, say, 10 categories beforehand:

. gen ygroup = autocode(y,10,1,n)
. graph bar x1 x2 x3 x4 x5, perc over(z) over(ygroup)

> The variable "z" is coded numerically (from 1 to 5). #1 refers for
> example to foreign cars. I would thus like to see the label "foreign
> cars" on the x-axis rather than the number 1. How can I modify this? Is
> it possible in graph bar?

Yes, it is. Check out the group_options in -help bar-. An example is shown 
below.

. graph bar x1-x5, perc  ///
   over(z, relabel(1 "mylab" 2 `""1st line" "1nd line""'))  

regards,

Uli


-- 
[email protected]
+49 (030) 25491-361
*
*   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