On Tue, 16 Oct 2007, andreas.rosenblad(a)ltv.se wrote:
I am writing a function that, when used with some bad input
variables,
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)
loop 1
genr rvar = (x = 0)
if sum(rvar) = 0
funcerr "ERROR: empty sub-sample!"
end if
smpl rvar --restrict
endloop
end function
open data4-1
badfun(price)
This now prints:
? badfun(price)
badfun: "ERROR: empty sub-sample!"
Allin Cottrell