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: mutually exclusive options within a program


From   Marco Savegnago <[email protected]>
To   [email protected]
Subject   Re: st: mutually exclusive options within a program
Date   Wed, 19 Feb 2014 12:20:25 +0100

It worked!
Thank you very much!

Marco

2014-02-19 11:54 GMT+01:00 Nick Cox <[email protected]>:
> This can be answered quickly.
>
> Make your options take string arguments, but don't tell the user that.
> So, your first level of checking is whether both options were
> specified:
>
> if "`alpha'" != "" & "`beta'" != "" {
>        <terminate>
> }
>
> Your second level of checking is for appropriate numeric input.
>
> Nick
> [email protected]
>
>
> On 19 February 2014 10:36, Marco Savegnago <[email protected]> wrote:
>> Dear statalist,
>>
>> I'm writing a program which has to accept only one of two possible
>> options (say either alpha or beta in the code below, each one with a
>> default value):
>>
>>
>>      syntax [, alpha(integer 5) beta(integer 10)]
>>
>>
>>
>> I need Stata to return an error code whenever these two options are
>> invoked together.
>>
>> How can I achieve this?
>>
>> Thanks for your consideration,
>>
>> Marco Savegnago
>> *
>> *   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/
*
*   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