On Tue, 16 Oct 2007, andreas.rosenblad(a)ltv.se wrote:
I am writing a function that, when used with some bad input
breaks with the following error message:
No observations would be left!
>> smpl group != groupremove_k --restrict
I would prefer to have the possibility to
a) Prevent these error messages from the output and instead provide my own
error message, e.g. funcerr "ERROR: No observations left!"
or, if this is not possible,
b) prevent the error message ">> smpl group != groupremove_k --restrict"
from the output and only have the output "No observations would be left!".
Yes, I see there's a problem with controlling error-reporting from
loops inside functions. I think this is now fixed in CVS. For
example (silly example, but never mind):
function badfun (series x)
genr rvar = (x = 0)
if sum(rvar) = 0
funcerr "ERROR: empty sub-sample!"
smpl rvar --restrict
This now prints:
badfun: "ERROR: empty sub-sample!"