Chapter Contents

Previous

Next
ERROR

ERROR



Reports whether a FRAME entry control or field contains an invalid value

Category: Control or Field


Syntax
Details
Examples
Example 1: Using ERROR to Report Invalid Values
Example 2: Generating a Compile Error with ERROR
See Also

Syntax

rc=ERROR(wvar-name);

rc
indicates whether the FRAME entry control or field in the window is in error:
1 in error
0 not in error

Type: Numeric

wvar-name
is the name of a FRAME entry control or field in the window. This argument cannot be an expression.

Type: Character


Details

Use ERRORON and ERROROFF to set and reset error conditions for the FRAME entry control or field.

The FRAME entry control or field cannot be an element of an array. To report this information for an array element, use FIELD instead.

FRAME entry controls can also use the _inError method.


Examples

Example 1: Using ERROR to Report Invalid Values

Specify the CONTROL statement with the ERROR option in the INIT section of the program. The statements in the MAIN section are submitted only if the FRAME entry control OBJ1 is not in error.

INIT:
   control error;
return;
MAIN:
   if (error(obj1)=0) and obj1 NE _blank_ then
      submit continue;
         proc print data=&obj1;
         run;
      endsubmit;
   else
_msg_='Nothing submitted.  Please correct error.';
return;

Example 2: Generating a Compile Error with ERROR

The following sequence generates a compile error because the variable DS is not a window variable but contains the name of a window variable. ERROR expects to be passed the window variable itself.

ds='tablename';
if (error(ds)) then
   do;
   ...SCL statements to handle the error condition...
   end;

See Also

DISPLAYED

ERROROFF

ERRORON

FIELD

MODIFIED


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.