--- On Mon, 11/1/10, Bob <[email protected]> wrote:
> In principle, my script works now but it is very slow, I
> would say like factor 20 to the version of the program where
> all variable names are spelled out and no loops are used.
> The program is used in an evaluator function for a
> regression and thus called many times. I suppose it has to
> do with for loops and the frequent string replacements
> coming with the macro replacements of the `var's. I am using
> a lot of macros to do a number of calculations.
>
> Is there a better way of getting something equivalent to
> "variables" in other programming languages so that I can
> reduce the string replacements?
That depends what it is exactly that you want to do. I
an guessing you want to select a number of variables based
on some (to me unknown) criterium. It probably can be speeded
up, but how depends on the cireterium.
> Is there a guide on how to do efficient programming and
> flow control in STATA?
You can look at: Christopher F. Baum (2009) "An Introduction
to Stata Programming", College Station: Stata Press.
http://www.stata-press.com/books/isp.html
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/