Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: Oddity with -bootstrap- handling an option on command input


From   "Lacy,Michael" <Michael.Lacy@colostate.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: Oddity with -bootstrap- handling an option on command input
Date   Mon, 19 Sep 2011 13:30:00 +0000

I just found a situation in which -bootstrap- appears to be confused by the presence of the letter "l" ("el") as a name for one of the parameters
of the command it is given to execute.  -bootstrap- appears to confuse this for its own level() option.  Here is a nonsense example that demonstrates this behavior:

cap prog drop test_with_l
prog test_with_l, rclass
  syntax varlist, l(integer)
  summ  `varlist'
  return scalar m = r(mean) = -999
end
//
cap prog drop test_with_hidel
prog test_with_hidel, rclass
  syntax varlist, hidel(integer)  // option renamed "l" to "hidel" to not confuse -bootstrap-
  summ  `varlist'
  return scalar m = r(mean)
end
//
sysuse auto
local somevalue = 4
//
// This works.
bootstrap r(m), reps(10) : test_with_hidel weight price, hidel(`somevalue') 
//
// The following gives an error, as -bootstrap- thinks "l" refers to its level() option
bootstrap r(m), reps(10) : test_with_l weight price, l(`somevalue') 

-------------------------------------

I can produce the same problem with -permute-.

Is this a feature, i.e., are option names generally to be regarded as reserved words in relation to commands that accept
a command name?  I would have thought that -bootstrap-'s own macros, and that of its input commands, would
not share namespace.

I'm running version 11.2, updated, Win XP, for what it's worth. 

Regards,

Mike Lacy
Dept. of Sociology
Colorado State University
Fort Collins CO 80523-1784


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index