Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: Re: st: Re: help with loops


From   n j cox <[email protected]>
To   [email protected]
Subject   Re: Re: st: Re: help with loops
Date   Tue, 05 Dec 2006 16:50:44 +0000

In addition to Austin's direct reply, note that
Robert's question is (a close relative of) an FAQ.

Is there a way to tell Stata to try all values of a particular variable in a foreach statement without specifying them?
http://www.stata.com/support/faqs/data/foreach.html

Nick
[email protected]

Austin Nichols replied to Robert Ndugwa

levelsof id, local(ids)
foreach i of local ids {
tw (scatter score date if id==`i' & class=="AA", legend(label(1 "AA")
label(2 "BB")) ytitle(id`i')) (scatter score date if id==`i' & class=="BB")
gr export child_`i'.wmf
}

> I have a data set that looks like below. I want to graph a series of plots
> where i plot on the same scatter the score by on several available dates for
> the same person id. I need individual graphs for each Id. But i dont have a
> continous running ID as some IDs are exlcuded due to no entries.
> For example i dont have entries for ID=6 here so i dont need any graph for
> this.
>
> How can i make the program only to plot where ID exists?
> by current program looks like this
*
* 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