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: Command line syntax for optional and required numeric statements


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Command line syntax for optional and required numeric statements
Date   Fri, 11 Jan 2013 20:09:00 +0000

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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index