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

Re: st: Problems with program

From   Christian Holz <>
Subject   Re: st: Problems with program
Date   Fri, 19 Aug 2005 12:15:23 +0100

you'd have to define the -syntax- of you program after the -program define- line.
You'd tell Stata how the syntax of your program -regse- should look like and to which variables the option should be parsed. The help of -syntax- should make it pretty clear.
Christian Holz
Department of Sociology
University of Glasgow
Scotland, U.K.

Andrea Molinari wrote:

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" <>
To: <>
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:

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index