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

st: Re: multiple graphs


From   Christopher F Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: multiple graphs
Date   Wed, 11 Dec 2002 06:34:10 -0500

--On Wednesday, December 11, 2002 2:33 -0500 Ricardo wrote:

I need some help using log files.

I am trying to run some graphs a the same time using this command:

foreach var of varlist x1 x2 x3 x4 x5 x6 x7 x8 x9 {graph `var'  y, by (z)
}

My questions is how can I get all the graphs in one singles log file? I
am  trying to avoid the copy/paste solution, because that would force me
to do  it out of the foreach
I don't know what you mean by 'in the log file' since graphs do not appear in the log file (which is a text file) in any case. However you can use the 'saving' option in the graph command to create graph files, e.g. saving(g`var',replace) which will create gx1.gph, gx2.gph, etc (which would probably be more useful if the variables had more descriptive names.

You may then use something like
graph using gx1 gx2 gx3 gx4 gx5 gx6 gx7 gx8 gx9
to view all the graphs on one screen.

Also note that if your variables are named like this, you could do

forv i=1/9 { graph x`i' y, by(z) saving(gx`i',replace)

Kit
*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index