On Wed, 26 Dec 2012, artur tarassow wrote:

> despite the fact that I activated "set warning off",
> I receive the message "No observations would be left!" after 
> selecting an obviously non-existing panel data sample. 
> Actually I would expect no message at all in this case. Is 
> this intended, or a 'bug'? It is a bit annoying as it 
> appears in the txt-output using the 'outfile' command.

>From "help set":

<quote>
warnings: off or on (the default). Suppress or resume the 
printing of warning messages issued when arithmetical 
operations produce non-finite values.
</quote>

So this setting doesn't claim to do what you supposed. 
Besides, trying to set a null sample is an error, and by 
design you can't turn _error_ messages off.

I'm assuming you're using the --restrict option with the 
"smpl" command. If you're doing that in an automated fashion 
in a script you should first check that the command will work,
as in

<hansl>
nulldata 20
set echo off
set messages off
sample_min = 5 # your choice
series condition = uniform() > 0.9
sample_size = sum(condition != 0)
if sample_size >= sample_min
   smpl condition --restrict
   # and do stuff
endif
</hansl>

Allin Cottrell



Reply via email to