First off, you need to read up some basics on -encode-
and -decode-.
I know of 50 U.S. states, so I am not clear how you get
10 different graphs with 10 different states on each.
I guess 10 different graphs with 5 states on each.
First, you have to set up your grouping in advance.
Let a variable -group- indicate each subset of states.
Set it up so that the values run from 1 to 10.
A minimal recipe which you will want to complicate is
decode id, generate(ID)
forval i = 1/10 {
levelsof ID, local(IDS) clean
xtline sexratio if group == `i', subtitle("`IDS'")
}
Nick
[email protected]
Scott Cunningham
> I have a small dataset containing the ratios of men to women for
> blacks and whites at the United States level that varies by age. I
> want to use -xtline- to create 10 different graphs, with the name of
> 10 different U.S. states above each graph. The data is tsset as:
>
> . tsset id age
>
> where "id" is a numerical identifier of a United States state
> and age
> is the sex ratio for that state at different ages. I've labeled the
> values of "id" using "label define idlbl # [name]" so that
> each value
> has its accompany US State. Is there a way to cause xtline
> to report
> the names of each state used to create each independent sex ratio?
> Because, when I do this:
>
> . xtline sexratio
>
> it reports a number above each graph.
*
* 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/