Vous êtes sur la page 1sur 2

But you can use the over option to get one bar for each value of a categorical variable

you
choose, with the height of each bar equal to the value of the stat_choice you chose for
the quantitative variable you specified:

I. GRAPH BAR (MEAN) PRICE, OVER(REPAIR)

And you can make a similar bar graph over two different categorical variables:

II. GRAPH BAR (MEAN) PRICE, OVER(REPAIR) OVER(ORIGIN)

Compare that to what happens if you type the over(repair) and over(origin) in the
reverse order:

III. GRAPH BAR (MEAN) PRICE, OVER(ORIGIN) OVER(REPAIR)

You can avoid the overlapping labels for “Domestic” and “Foreign” by inserting another
option inside the over(origin)option:

IV. GRAPH BAR (MEAN) PRICE, OVER(ORIGIN, LABEL(ANGLE(45)))


OVER(REPAIR)

You can get Stata to leave out the categories with no observations—i.e., (repair=F &
origin=”Foreign”) and (repair=D & origin=”Foreign”)

V. GRAPH BAR (MEAN) PRICE, OVER(ORIGIN, LABEL(ANGLE(45)))


OVER(REPAIR) NOFILL
2

But you can use the over option to get one bar for each value of a categorical variable you
choose, with the height of each bar equal to the value of the stat_choice you chose for the
quantitative variable you specified:

graph bar (mean) price, over(repair)

And you can make a similar bar graph over two different categorical variables:

graph bar (mean) price, over(repair) over(origin)

Compare that to what happens if you type the over(repair) and over(origin) in the
reverse order:

graph bar (mean) price, over(origin) over(repair)

You can avoid the overlapping labels for “Domestic” and “Foreign” by inserting another option
inside the over(origin)option:

graph bar (mean) price, over(origin, label(angle(45)))


over(repair)

You can get Stata to leave out the categories with no observations—i.e., (repair=F &
origin=”Foreign”) and (repair=D & origin=”Foreign”)

graph bar (mean) price, over(origin, label(angle(45)))


over(repair) nofill

Vous aimerez peut-être aussi