Chapter Contents

Previous

Next
SAS Component Language: Reference

Stopping Execution of the Current Section

The STOP statement stops the execution of the current section. If a MAIN or TERM section is present, control passes to MAIN or TERM. For example, in the following program, control passes from INIT to SECTONE. Since X=1 is true, the STOP statement is executed, so control never passes to TWO. Control passes directly from the STOP statement in SECTONE to MAIN. The STOP statement at the end of MAIN has no effect, and control passes to TERM.

INIT:
  put 'beginning INIT';
  x=1;
  link SECTONE;
  put 'in INIT after link';
stop;

MAIN:
  put 'in MAIN';
stop;

SECTONE:
  put 'in SECTONE';
  if x=1 then stop;
  link TWO;
return;

TWO:
  put 'in TWO';
return;

TERM:
  put 'in TERM';
return;
This program produces the following output:
beginning INIT
in SECTONE
in MAIN
in TERM

For more information, see STOP.


Chapter Contents

Previous

Next

Top of Page

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