I recoded my simulation exercises ...
Initially I was using -while- loops within which there 3 lines and each line
was checking all observations of the dataset. This was clearly inefficient.
Now I adopted two variations: (1) the -forval- approach as Nick pointed out
and (2) -while- loop but cleverly jumping through groups/iterations as
Michael suggested.
Now my simulations are atleast 12 times faster...
It is heartening to see that simulations, which used to take 8 hours or
more, are now being accomplished in about 40 minutes.
Thanks Nick and Michael.
I am learning new things everyday.
Subh
*
* 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/