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]
st: Re: Unable to clear "invalid syntax r(197);" error in user-written .ado file
From
"Joseph Coveney" <[email protected]>
To
<[email protected]>
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:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/