st: bootstrapping -- why am I not getting the full sample size?

All,
I'm trying to bootstrap a cost-effectiveness ratio, using a user-written
program. Components are differences in cost of treatment, and
differences in survival time. My user-written program works just right,
but it bombs when submitted to the bootstrap routine. What happens is
that the first resample (after the run on the entire dataset) contains a
resample with about a third of the patients that were in the original
sample. The truncated sample size exactly corresponds to the number of
control group patients in the study. Given that there are no
experimental group patients in the control group :-) the estimation of
restricted mean survival time for the experimental group naturally bombs
out.
I've tried several fixes, including reordering the component procedures
in the user-written program, applying --stset, clear-- to clear the
survival settings for the data, and doing a --sum-- on a variable that
has valid observations for all cases just before the end of the program.
Nothing seems to get me out of the hole of having a much smaller
dataset. Any ideas? I suspect it has something to do with --stset--ing
the data, as the routine runs fine if the survival stuff is omitted.
Perhaps I'm missing something obvious, though.
Thanks,
Brad Smith
Here's a pared-down version of my user-written program that works with
the hmohiv dataset:
------------------------------------------------------------------------
sysuse hmohiv
capture program drop myRatio
program myRatio, rclass
version 9
*compute restricted mean survival times
stset time, f(censor=0)
stci if drug==0 , rmean
local contime = r(rmean)
stci if drug==1 , rmean
local exptime = r(rmean)
*compute ratio
local survdif = ((`exptime' - `contime')/365)
return scalar ratio = `survdif'
end
And the bootstrap call (set to 2 since the subsequent runs weren't
working):
bootstrap ratio=r(ratio), noisily reps(2): myRatio
------------------------------------------------------------------------
*
* 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/