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
njcoxstata@gmail.com
On 8 April 2013 20:28, Christopher Zbrozek <zbrozek@gmail.com> 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/