Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: syntax command with optional argument


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: syntax command with optional argument
Date   Wed, 10 May 2006 13:49:04 -0400

You need to include the default value, if it is optional:

  syntax  ... , [ arg2(integer 999) ]

This would generate a default value of 999.

--Nick Winter

At 01:31 PM 5/10/2006, you wrote:
Using Stata 8.2... what am I doing wrong?

Thanks.

. clear

. program test1
1. syntax namelist(min=2 max=2), arg1(integer)
2. end

. program test2
1. syntax namelist(min=2 max=2), arg1(integer) [arg2(integer)]
2. end

. test1 foo bar, arg1(5)

. test2 foo bar, arg1(5)
invalid syntax
r(197);

.

This message is intended solely for the designated recipient(s). It may contain confidential or proprietary information and may be subject to confidentiality protections. If you are not a designated recipient, you may not review, copy, or distribute this message. If you receive this in error, please notify the sender by reply e-mail and delete this message.

Arrowstreet Capital, L.P. is an Equal Opportunity Employer.



*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
________________________________________________________
Nicholas J. G. Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
Cornell University falcon.arts.cornell.edu/nw53 w
308 White Hall
Ithaca, NY 14853-4601

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index