Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: -syntax- options names


From   Dan Blanchette <[email protected]>
To   [email protected]
Subject   st: -syntax- options names
Date   Tue, 17 Feb 2009 15:33:19 -0500 (EST)

Did you already know that when writing a Stata program you ironically can't name an option that begins with the letters "no"? If you really need to name an option that starts with the letters "no", you can do it if you specify it in one or more capital letters.

Here's a short program that is an example of what I'm talking about:

==============================================================================
. program nuts
1. syntax [, NOformats nformats no_formats no_fmts no_fts no_no no_big_deal
no_big oh_no not _no _no_luck no_data NODATA ]
2. foreach lm in noformats nformats no_formats no_fmts no_fts no_no
no_big_deal no_big oh_no not _no _no_luck no_data nodata {
  3.   di "`lm' = ``lm''"
  4. }
  5. end

. nuts , noformats nformats no_formats no_fmts no_fts no_no no_big_deal no_big
oh_no not _no _no_luck no_data nodata
noformats = noformats
nformats = nformats
no_formats =
no_fmts =
no_fts =
no_no =
no_big_deal =
no_big =
oh_no = oh_no
not =
==============================================================================

I've tested this with Stata version 9 and 10.

Any insights as to why this is the case?  Is there other similar character
strings you can't start an option name?

I almost have -saswrapper- ready for release.  Anyone wishing to test it out,
please contact me.

Best,

Dan Blanchette
Research Associate
Center of Entrepreneurship and Innovation
Duke University's Fuqua School of Business
Durham, NC  USA
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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