Code: Select all
all 200
*
* Source range
*
compute gstart=1,gend=100
set test gstart gend = %ran(1.0)
*
* Create indexing function into the source range, only for observations
* which are negative. (Any SMPL criterion can be used instead).
*
order(smpl=test<0,index=myindex) constant gstart gend
*
* Determine the end of the (indexed) range which meets the criterion.
* The entries map to gstart->gstart+%nobs-1, since %nobs will be the
* number of data points which met the SMPL.
*
compute bstart=gstart,bend=bstart+%nobs-1
*
* Target range
*
compute tstart=101,tend=200
*
* Draw boot entries, then remap them to the entries in the original series
*
boot entries tstart tend bstart bend
gset entries tstart tend = myindex(entries(t))
*
* Use the remapped entries as needed
*
set allnegative tstart tend = test(entries(t))
stats(fractiles) allnegative