SAS Component Language Dictionary |
Reports whether a pending event has occurred
-
rc
-
contains the return code for the operation:
1 |
a pending event has occurred. |
0 |
a pending event has not occurred. |
Type:
Numeric
EVENT is useful when you want your application
to continue a task while it waits for user input. For example, your application
can read data from an external source and display the results. When a user
presses an appropriate key, you can stop processing and handle the request.
An event can be a mouse button press or a keyboard key press. An event
can also be generated by a frame display or redisplay. Once a pending event
has occurred, the EVENT function returns 1 until the frame has been redisplayed.
A pending event can also be a system event that the user did not directly
cause. For example, the autosave feature, which is designed to save work in
SAS at a specified interval, generates an event that the EVENT function detects.
To avoid accidentally triggering the EVENT function, the autosave feature
can be disabled through either the SAS Preferences dialog box or the WAUTOSAVE
OFF command. You can find the autosave preference by selecting Tools
Options
Preferences... and the Edit
tab.
Operating Environment Information: z/OS
EVENT
does not work under z/OS. On this
system you should use the attention handler exit that is provided in SCL.
Refer to the discussion of the BREAK option for CONTROL. ![[cautionend]](../../../../common/62850/HTML/default/images/cautend.gif)
Display the date and time until a user presses either
ENTER or one of the function keys. The variable DATETIME is a numeric text
control on a frame entry and has the format DATETIME17.2. When a user presses
ENTER or a function key, the program exits the loop and returns control to
the application. In this example, when a user issues a RUN command, the loop
resumes.
INIT:
control allcmds;
return;
MAIN:
if _status_ in ('C','E') then return;
if (word(1,'U')='RUN') then
do while(event()=0);
datetime.text=datetime();
refresh;
end;
return;
TERM:
return;
CONTROL
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.