Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: options in stata


From   "NEYMOTIN, FLORENCE" <[email protected]>
To   [email protected]
Subject   Re: st: RE: options in stata
Date   Thu, 07 Jul 2005 17:13:53 -0700

cool. thank you.

On Fri, 8 Jul 2005 00:15:23 +0100
 "Nick Cox" <[email protected]> wrote:
If -t- has been input, it is a non-empty string, so I would program this something like
if "`t'" != "" {
} else {
}
Or, more likely, I would fill in a default:
if "`t'" == "" local t "1 2 3"
Thus, the key is to exploit the fact that such an option has no default and thus is empty if and only if the user didn't specify it.
Nick [email protected]
NEYMOTIN, FLORENCE


how do you refer to an option for a number list? for instance, suppose I write an .ado file where t(numlist) is an OPTIONAL element, so the user could input t(10 20 30 40 50) or no t at all. If I want to write a case-selection statement that looks like:

if t has been input by the user {
...
}
else {
...
}

then what is the REAL code for the if-statement here?
*
*   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/
*
*   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