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

RE: st: Graphs and Log files


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Graphs and Log files
Date   Thu, 12 Dec 2002 09:17:28 -0000

Ricardo Mora-Castrillo
> 
> > Now I am trying to run this in a more efficient way?? Does 
> > any of you have an idea?
> > 
> > foreach varx0 of varlist pill0 iud0 vag0 condom0 rhythm0 
> > withd0 stfem0 
> > stmasc0 inject0 {
> > foreach varx1 of varlist pill1 iud1 vag1 condom1 rhythm1 
> > withd1 stfem1 
> > stmasc1 inject1 {
> >    graph `varx0'`varx1' year, symbol(i i) connect(l l[.]) 
> > xscale(1975,2000) 
> > yscale(0,1) saving(`varx0', replace)
> > }
> > }
> 
> The two nested loops will produce 9 * 9 
> graphs. I suspect you want just 9 graphs, as in 
> 
> foreach v in pill iud vag condom rhythm withd stfem stmasc inject {
> 	graph `v'0 `v'1 year, symbol(ii) connect(ll[.]) /* 
>       */ xscale(1975,2000) yscale(0,1) saving(`v', replace)
> }
> 

Not the question, but there's 
a very simple tip here which may be of wider interest. 

You want what is often called a line graph 
to show time series, in which segmented 
lines are used. Suppressing the point 
symbols by e.g. -sy(ii)- and using different 
line styles then often seems the best
way to distinguish two or more series. 

The tip is to use e.g. -sy(..)- together 
with line styles as e.g. above. The dots 
used as point symbols will then be 
at most unobtrusive, but for 2, 3 or 4 
series you will get legends in the 
space of the -t1()- and -t2()- titles. 
(With a few more than 4 series you can still 
get legends with the aid of some 
user-written work-around.) 

Nick 
[email protected] 

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