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: Command line syntax for optional and required numeric statements
From
Stephen Cranney <[email protected]>
To
[email protected]
Subject
Re: st: Command line syntax for optional and required numeric statements
Date
Fri, 11 Jan 2013 16:24:47 -0500
I'm still getting the "invalid syntax" response. I tried making it all
optional and setting default values just to make it simpler. Now I
have
syntax [, startyear(real 2000) birthday (real 9) birthmonth (real 1)]
I've seen various examples online that have this same format that don't
seem to be having the same problem, so I guess at this point my main
question is: in what situations would Stata return an "invalid syntax"
response based on something put in the "syntax" line in the ado file?
Setting trace on doesn't help because "invalid syntax" is
the first thing that pops up.
Best,
Stephen
On Fri, Jan 11, 2013 at 3:09 PM, Nick Cox <[email protected]> wrote:
> The pattern
>
> latestageatbirth(default=50)
>
> isn't correct for options. See -help syntax-. Try e.g.
>
> latestageatbirth(real 50)
>
> Nick
>
> On Fri, Jan 11, 2013 at 7:31 PM, Stephen Cranney <[email protected]> wrote:
>
>> Apologies if this is simple, but I can't figure this out based on the
>> documentation.
>>
>> I'm writing an ado file and am trying to transfer all the macros I
>> reference inside the file to the command line. Some of the values I want to
>> make required, and some I want to make optional, but with a default value
>> if the option is not taken. All of the macros I want in the command line
>> are numeric.
>> A representative snippet of the code is below, based on what I've been able
>> to figure out from the documentation. It gives me an "invalid syntax"
>> response when I try to "birthsim, startyear(2000)...". It works when I do
>> it with args, but obviously that's much more cumbersome than syntax in this
>> context.
>>
>> program birthsim, rclass
>> version 11.2
>> syntax startyear(integer) endyear(integer) [,latestageatbirth(default=50)
>> ]
>>
> *
> * 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/