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: bug in bs4rw (or bug in Stata?)


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: bug in bs4rw (or bug in Stata?)
Date   Wed, 23 Mar 2011 09:45:41 -0500

Keith Dear <[email protected]> is using -bs4rw- (which has been superseded
by -svy bootstrap- in Stata 11) and is getting an unexpected error message
from his prefixed command due to how -bs4rw- is calling it:

> -bs4rw- bootstraps a command which may be user-defined. It seems the
> command MUST have options, or at least a syntax statement ending in ",
> *". This seems undesirable.
> 
> The following code snippet from bs4rw.ado shows that `cmdname' is
> called with a comma even if `cmdopts' and `rest' are empty.
> If `cmdname' in fact has no options, this causes bs4rw to crash with
> the error message "options not allowed".
> .       capture noisily quietly `noisily' `version'     ///
> .                `cmdname' `cmdargs'                     ///
> .                `wgt' if `touse', `cmdopts' `rest'
> (This is in the code section "bs4rw: First call to `cmdname' with data
> as is" : later on the issue is handled more carefully.)
> 
> 
> 
> But anyway, it seems to me that this should not be a problem, and the
> bug is really in the Stata language, not in bs4rw after all. Consider
> this:
> 
> . prog snip
> .    syntax
> . end
> . snip     // no effect of course, but no problems either
> . snip ,   // the comma triggers the "options not allowed" error even
> though no options have been given.
> 
> Should this be an error? I don't think so.

Nick Cox has already replied with a clear description of how Stata interprets
the following two commands:

	snip
	snip ,

-bs4rw- was designed to work with estimation commands that post their results
in -e()-, but it also supports other commands that post their results in -r()-
or global scalars and matrices.  At a minimum, -bs4rw- requires that the
prefixed command allow -pweight-s and/or -iweight-s and an -if- condition.  So
the prefixed command must allow the following minimum syntax

	syntax [pw iw] [if]

I can see how this specification is not exactly sufficient to work with
-bs4rw-.  As Keith has already pointed out, the minimum syntax must also allow
a comma.  Until -syntax- learns to tolerate lonely commas, Keith can add a
NULL option to the above syntax.  For example

	syntax [pw iw] [if] [, NULLOPT]

--Jeff
[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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index