Chapter Contents

Previous

Next
SAS Component Language: Reference

Branching to Another Entry (GOTO)

You can use the GOTO statement to transfer control to another SAS/AF entry.

CALL GOTO (entry<, action<, frame>>);
Entry specifies a FRAME, PROGRAM, MENU, CBT, or HELP entry. By default, when the entry ends, control returns to the parent entry that was specified in entry. If a parent entry is not specified, then the window exits.

For example, suppose WORK.A.A.SCL contains the following code:

INIT:
  link SECTONE;
  put 'in INIT after link to SECTONE';
return;

SECTONE:
  put 'in SECTONE before link to TWO';
  link TWO;
  put 'in SECTONE before goto';
  call goto('work.a.b.frame');
  put 'in SECTONE after goto to frame';
return;

TWO:
  put 'in TWO';
return;
WORK.A.B.SCL contains the following code:
INIT:
  put 'in WORK.A.B.FRAME';
return;
If you compile WORK.A.B.FRAME and WORK.A.A.SCL, and then test WORK.A.A.SCL, you will see the following output:
in SECTONE before link to TWO
in TWO
in SECTONE before goto
in WORK.A.B.FRAME
The PUT statement in the INIT section of A.SCL and the last PUT statement in SECTONE are never executed. After WORK.A.B.FRAME is displayed and the user exits from the window, the program ends.

For more information, see GOTO.


Chapter Contents

Previous

Next

Top of Page

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