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

st: RE: Re: autogeneration of graphs


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: autogeneration of graphs
Date   Sat, 27 Jul 2002 13:38:30 +0100

Christopher F Baum
> 
> This will certainly work, but will cause a number of graphs 
> to just display 
> on the screen. Perhaps adding   saving( ) would be useful. 
> However that 
> brings up a limitation of by (which is a wonderful feature, 
> but sometimes 
> does not do all that one needs...) It also does not allow 
> labelling of the 
> graphs. A modified
> approach using Nick Cox' 'levels' (ssc desc levels):
> 
> use auto
> g str1 mm = substr(make,1,1)    * equiv of census tract
> levels mm,macname(cars)

[NJC: syntax is -levels mm, local(cars)- ] 

> foreach c of local cars {
>    graph price mpg if mm=="`c'", saving(cars_`c',replace) 
> ti("Cars of make 
> `c'")
> }
> 
> This will create files cars_A.gph, cars_B.gph, etc., with 
> the graph titles 
> containing information on the category being graphed.
> 
> In fact one can then do asomething like
> 
> graph using cars_A cars_B cars_C cars_D
> 

One extra trick sometimes useful here: 
add -more- so that you get a slide show, not
a movie. 

foreach c of local cars {

	graph price mpg if mm=="`c'", saving(cars_`c',replace) 
	ti("Cars of make > `c'")

	more 
}

*
*   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