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

Re: st: Problems with program


From   Christian Holz <statalist@krueschan.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Problems with program
Date   Fri, 19 Aug 2005 12:15:23 +0100

Andrea,
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.
---
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!
Andrea


----- Original Message ----- From: "n j cox" <n.j.cox@durham.ac.uk>
To: <statalist@hsphsun2.harvard.edu>
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.

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


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