Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: Re: Unable to clear "invalid syntax r(197);" error in user-written .ado file

From   "Joseph Coveney" <>
To   <>
Subject   st: Re: Unable to clear "invalid syntax r(197);" error in user-written .ado file
Date   Fri, 5 Oct 2012 11:37:24 +0900

Richard Herron wrote:

I wrote an .ado file to trim data in the left and right tails, but I
can't get past an "invalid syntax r(197)" error. My -syntax- line is
as follows.

* begin syntax line
    syntax varlist(numeric) [if] [in] ///
        [, Byvar(string fyear) Tail(real 0.5) Suffix(string tr)]
* end syntax line

I would like to use a -varlist- so that I can loop over the supplied
variables, but I can't clear the error using -varname- or by dropping
the -if- and -in- statements. I also tried making the options required
without defaults, but that didn't work either.

What is my misunderstanding of syntax? Thank you!

[remainder omitted]


It seems as if you're trying to supply default arguments to your string options.  It's my understanding that you cannot do that.  Try omitting them:

syntax varlist(numeric) [if] [in] ///
        [, Byvar(string) Tail(real 0.5) Suffix(string)]

local byvar = cond("`byvar'" == "", "fyear", "`byvar'")
local suffix = cond("`suffix'" == "", "tr", "`suffix'")

Joseph Coveney

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index