Many thanks for all your replies!
Nick, you're totally right. The main problem is that I can't put the program
inside the loop because the word -end- stops the loop.
I'm sorry for my ignorance, but can I please ask what did you mean by "pass
`var' to -regse- in an option"? I thought this meant to define the local in
the program, but that didn't work either.
Many thanks again and again!
----- Original Message -----
From: "n j cox" <firstname.lastname@example.org>
Sent: Thursday, August 18, 2005 5:17 PM
Subject: Re: st: Problems with program
> If I understand this correctly, this has nothing to do with -outreg-,
> -estout- or any other program downstream. The problems are within your
> own code.
> You refer to `var' within your program -regse- without ever defining it
> previously in the same program. This is not illegal but Stata will
> interpret the reference to a non-existent macro as an empty string and
> the result will presumably not be what you want.
> That is, `var' within program -regse- is a local macro
> name. The fact that the -foreach- loop outside your
> program also uses a local macro name `var' has no implications
> within your program. The two are in completely different
> name spaces. That is precisely what the "local" of "local
> macro" means.
> One possibility is to pass `var' to -regse- in an option.
> * 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/
* For searches and help try: