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

st: RE: Re: RE: Re: RE: Multiple commands under "By varlist"?


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: RE: Re: RE: Multiple commands under "By varlist"?
Date   Sat, 26 Jun 2004 16:06:34 +0100

Yes and no. Sorry to repeat the point, but you 
put the blame in the wrong place again
in talking of the inefficiency of -while-, 
which is just a framework and not to blame 
for what's inside. 

The ineffiency of -while- is in going (e.g.)

local i = 1 
while `i' < 1000 { 
	...
	local i = `i' + 1 
} 

rather than (say) 

forval i = 1/1000 { 
	...
}

-- although note that not every -while- 
can be made a -forval- --

but that's small beer compared with the 
possible inefficiency of what the user 
puts within the loop, which is the issue here. 

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

Subhankar Nayak
> 
> Yes, that's a very interesting point that I had missed.
> I now see why -while- is so inefficient: it reads such a huge 
> fraction of
> unneccesary observations. I can avoid that by more efficient 
> treatment of
> the observation: avoid reading all those unneccesary observations
> repeatedly.

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