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: syntax error


From   Sergiy Radyakin <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: syntax error
Date   Tue, 22 Oct 2013 19:21:56 -0400

David,
Nick has answered it already, but I will just rephrase the manual,
gettoken allows at most two names before the column, but you have
specified 3. The square brackets in the syntax diagrams mean that the
content is optional, but this should not be interpreted as the content
can be stretched to become an array.
Best, Sergiy

On Tue, Oct 22, 2013 at 7:03 PM, David Rivenbark
<[email protected]> wrote:
>             I have written a simple rclass program that has the following
> structure.
>
> Program MYprog, rclass
>
>      syntax varlist [if] [in] [, opt1(real 0) opt2(real 0) . ]
>
>      gettoken y x1 x2 : varlist
>
>      tempvar q
>
>      gen double `q' = f(`y',`x1',`x2')
>      sum `q'
>      return scalar mean=r(mean)
>
> end
>
>
> When I run the program with "MYprog y x1 x2" I receive an "invalid syntax"
> error message Stata reaches -gettoken-. Can someone help me understand my
> error using -gettoken-?
>
> *
> *   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