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

Re: st: Invalid file specification

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

Hendri Adriaens <>:
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 <> wrote:

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.

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";};

  /* 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,

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

*   For searches and help try:

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