An
SCL
labeled section is a set of programming statements that
execute as a unit. A section in SCL begins with a label and ends with
a RETURN statement.
Sections that are labeled
with the name of a control on the associated frame execute when the
user interacts with that control. For example, if you have a Push
Button named exitButton on your frame, and you want to use it to confirm
that the user wants to exit the application, you might have a labeled
section similar to the following in your frame SCL:
exitButton:
dcl list message={'Are you sure you want to exit?'};
response=messagebox(message, '!', 'YN', 'Confirm Exit', 'N', '');
if response='YES' then call execcmd('end;');
message=dellist(message);
return;The code in the exitButton section executes
when that exitButton is clicked, resulting in a dialog box to confirm
the exit.
The exitButton Confirmation Dialog Box
Section labels do not
have to match the casing of the name of the control to which they
are associated.
Frame SCL uses reserved
sections for program initialization and termination (there is also
a main processing section, but that is not covered in this document).
The INIT section executes once before the frame is displayed to the
user, and is typically used to initialize variables and open SAS tables.
The TERM section executes once before the frame is closed, and is
typically used to close tables and delete variables that are no longer
needed. You should always delete lists when they are no longer needed.
Here are example INIT
and TERM sections:
INIT:
dcl num variable1 rc; /* Declares two numeric variables. */
dcl list myList={}; /* Declares an empty list. */
return;
TERM:
rc=dellist(myList); /* Deletes the list myList. */
return;