Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: creating bar charts

From   Scott Cunningham <>
Subject   st: creating bar charts
Date   Fri, 24 Mar 2006 13:37:15 -0500

I have three variables: sexratio, age and race. Age takes on seven different values: 1, 5, 10, 15, 20, 25, and 30. Race takes on two value: 1 (white) and 2 (black). Sex ratio is the national ratio of on non-incarcerated men to women for each race and each age cohort (where "age cohort" refers to five-year gaps in age. So, "5" is 1-5 year olds, "10" is 6-10, and so on).

I'm trying to create a simply bar graph, and I've got it working for the most part, but I need to change a few things. Here's what I have so far:

. graph bar (asis) SexRatio, over(race) over(age) bargap(.80) legend ( label(1 "White") label(2 "Black") ) ytitle(Sex Ratio) title(Racial Dynamics in the U.S. Sex Ratio) note("Source: 2000 Census longform Summary File")

I thought that by changing the legend labels, it would actually report "white" and "black" instead of "1" and "2". But it doesn't. I'm not sure what exactly I did, then, by changing the legend in this way. There's no legend showing up, for instance, to the right of the graph if it was creating a legend.

Secondly, I wanted to make an xtitle, showing the reader that age was along the xaxis in five-year brackets, but when I included an -xtitle (Age)- I got an error. Any ideas?

* For searches and help try:

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