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

Re: st: generating one twoway graph using by


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: generating one twoway graph using by
Date   Fri, 24 Sep 2004 10:49:19 -0400

Nick Cox suggested three good, more-or-less pre-packaged solutions.

Another way to go, which generalizes to other cases where one needs to generate multiple graph statements, might be something like this:

levels PID , local(levs)
foreach val of local levs {
local cmd `cmd' (line ivalue idate if PID==`val')
}
graph twoway `cmd' , legend(off)

This builds up your (massive) list of graph commands in a loop, then executes them all at the end.

I'm not sure that plotting all 200 in one graph will generate anything comprehensible, but it can be done . . .

--Nick Winter



At 10:27 AM 9/24/2004 -0400, you wrote:

Hello all,

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?

Thanks in Advance,

Dan Egan
*
*   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/
--------------------------------------------------------
Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
308 White Hall falcon.arts.cornell.edu/nw53 w
Cornell University
Ithaca, NY 14853-4601

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