Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Invalid file specification


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: Invalid file specification
Date   Sat, 7 Jul 2007 09:33:11 -0400

Hendri Adriaens <[email protected]>:
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.

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.

On 7/7/07, Hendri Adriaens <[email protected]> wrote:
Hello,

I'm trying to do something for several files, using a loop. But somehow, it
doesn't work and the error message "invalid file specification" doesn't
really help.

#delimit;
forvalues x=1/4 {;
  if `x'==1 {local bestand="parsed_cfd.txt"; local zk="cfd";};
  if `x'==2 {local bestand="parsed_qds.txt"; local zk="qds";};
  if `x'==3 {local bestand="parsed_vfd.txt"; local zk="vfd";};
  if `x'==4 {local bestand="parsed_tsa.txt"; local zk="tsa";};

  #delimit;
  clear;
  /* Inlezen */
  insheet a b c d e using "`bestand'", tab;

[some more commands]

};

The complaint comes from insheet (invalid file specification, r(198)), but I
don't see why. I hope someone can help me as r(198) "syntax error" is not
really helpful.

Thanks already, best regards,
-Hendri.

PS: Why can't stata say what code it didn't like and why?

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index