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

st: RE: generating one twoway graph using by


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: generating one twoway graph using by
Date   Fri, 24 Sep 2004 15:34:30 +0100

Good news: There are various ways to do this. 

One is that if your data are well behaved this 
should work: 

. sort PID idate 
. line ivalue idate, connect(L) 

Another is to -tsset- these data and use -xtline-. 

. tsset PID idate 
. xtline ivalue, overlay legend(off) ... 

Another is to download -linkplot- from SSC: 

. ssc inst linkplot 
. linkplot ivalue idate, link(PID) 

-linkplot- has other uses besides this problem; 
the other solutions, however, may or should work 
with time series data, as yours evidently are. 

Nick 
n.j.cox@durham.ac.uk 

Daniel Egan
 
> I am trying to make a line plot of many individuals values over time
> in one graph. I am hoping that there is someway to shortcut around the
> syntax of -twoway- using -by- such that I do not need to specify all
> individuals (I have nearly 200).
> 
> I started with 
> twoway (line ivalue idate, by(PID))
> but that gave 200 individual graphs.
> 
> so did 
> twoway (line ivalue idate), by(PID)
> but that gave the same thing. 
> 
> 
> I am hoping to avoid needing to write
> twoway (line ivalue idate if PID==1) (line ivalue idate if 
> PID==2) ......
> 
> Should I stop hopeing, and start writing?

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