Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: options for syntax checking do files before running


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: options for syntax checking do files before running
Date   Mon, 8 Apr 2013 20:55:02 +0100

I don't think there is any such program. It would be foolish of me to
rule out the possibility of some script that catches common errors,
but my experience is that it is best to let Stata itself find your
bugs and miscodings as fast as possible.

Nick

Nick
[email protected]


On 8 April 2013 20:28, Christopher Zbrozek <[email protected]> wrote:
> Hello world,
>
> Is anyone aware of user-written code that would review a do file to
> ensure commands are written using valid Stata syntax? Or,
> alternatively, is there a way to exploit the Stata executable's
> internal syntax checker for this purpose?
>
> The idea is that because Stata code is interpreted rather than
> compiled, clearly boneheaded syntax errors aren't caught until
> runtime. For example, when insufficiently caffeinated this morning, I
> tried to use a command along the lines of
>
> replace myvar = "something" if missing(myvar) | if regexm(myvar, "myregex")
>
> which, with that second "if" in there, works about as well as one
> thinks it should.
>
> One (quasi-)solution is of course to debug code using a small sample
> dataset before running it on millions of observations, which
> ameliorates but doesn't fix the problem. A rather laborious solution
> would be to write an ado file or Perl script or something to find
> common syntax errors and run that at the top of a do file on the text
> of the do file itself. An ideal solution would be to somehow employ
> the syntax checking Stata will perform anyway rather than trying to
> reverse-engineer that portion of the Stata executable.
>
> Many thanks,
>
> Christopher Zbrozek
> University of Michigan
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index