|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: invalid file specification
In this case a useful technique (which is easily disabled when you
get tired of seeing it) is just to put a line
display "Now reading `bestand'"
just before the insheet, which would make it obvious which file it is
processing (if any error conditions occur within that file, for
instance) but would also show you that in fact the local had not been
given a value.
It is true that Stata does not make it easy to determine which line
is giving you grief in a loop context, but as Austin suggests good
old-fashioned debugging techniques work well. Putting output lines
into the do-file and just commenting them out when you no longer need
them is one of those techniques.
Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html
On Jul 8, 2007, at 2:33 AM, statalist-digest wrote:
Hi Austin,
In these situations, if you -set trace on- you can usually see the
source of the problem immediately. In this case, I suspect you have
forgotten that -if exp {- must appear on a line by itself (see -help
ifcmd-), i.e. you must have a delimiter between "{" and "local"
below.
Ok, thank you. I couldn't think that that was the problem from an
"invalid
file specification" error, so thanks for the help.
Your postscript assumes either Stata (or you) would want to -set tr
on- all the time, I think. Or somehow magically reach into the guts
of programs and tell you where you forgot a keystroke. Neither is
reasonable IMHO.
If stata can detect a syntax error, it does know what was not along
the
rules of the syntax and where it happened. It can tell me that
along with
the error message that it produces now. "Syntax error" is not at all
informative. Of course I made an error, otherwise the code would run.
- -set trace on- does work, except that it produces a lot of
output. (Yes, one
can set depth.) But it does include the syntax error that actually
made my
code fail. If only it would output that error and the code that
triggered
it, nothing more, certainly not error message that only confuse.
But anyway, thanks for your help. If my code fails again next time,
I will
- -set trace on- and hope that I can spot the true error message.
*
* 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/