Checks whether to issue a diagnostic, i.e. a fault, warning or message.
||Severity of the diagnostic (
||Diagnostic code; default
|expression||Logical expression to test whether or not to give the diagnostic|
FAULT can be used to generate a Genstat fault, warning or message, as requested by the
DIAGNOSTIC option. The diagnostic is printed in the standard Genstat format. So, for example, faults and warnings are recognised by Genstat for Windows, and added to the Event Log. Also, the diagnostic will be suppressed (like those from Genstat directives) if that has been requested by the
DIAGNOSTICS option of the
There is a single parameter, which supplies a logical expression to decide whether or not to give the diagnostic; if this is omitted, the diagnostic is always given. The
FAULT option defines the code to identify a fault or warning; this has a default of
'UF 1' for a fault and
'UF 2' for a warning. (Messages always begin with the standard prefix “Message: “.) The
EXPLANATION option allows you to supply some explanatory information.
FAULT is particularly useful in procedures. For example, in a regression procedure, you might put
FAULT [DIAGNOSTIC=fault; FAULT='VA 6';\
EXPLANATION='Y-variate must contain at least 2 values']\
NOBSERVATIONS(Y) < 2
Then, if the y-variate has less than two non-missing values, Genstat will give a “VA 6” fault, and execution of the procedure will stop. The available Genstat faults are listed in the on-line help.
Commands for: Program control.