1. Home
  2. BREAK directive

BREAK directive

Suspends execution of the statements in the current channel or control structure and takes subsequent statements from the channel specified.

Option

CHANNEL = scalar Channel number; default 1

Parameter

    expression Logical expression controlling whether or not the break takes place

Description

The BREAK directive allows you to halt the execution of the current set of statements temporarily so that you can execute some other statements. If the parameter is not set, the break will always take place. Alternatively, you can specify a logical expression and then the break will take place only if this produces a true (i.e. non-zero) result.

The CHANNEL option determines where the statements to be executed during the break are to be found. Usually (and by default) they are in channel 1. The statements are read and executed, one at a time, until an ENDBREAK statement is reached, at which point control returns to the statements originally being executed.

BREAK also provides a convenient way of interrupting a loop or a procedure so that you can read one set of output before the next is produced.

Option: CHANNEL.

Parameter: unnamed.

See also

Directives: ENDBREAK, DEBUG, CALCULATE.

Commands for: Program control.

Example

" Example BREA-1: Using the BREAK directive in a FOR loop"

VARIATE [NVALUES=13] X,Y,LogY
READ X,Y
60  78.5  52  74.3  20 104.3  47  87.6  33  95.9  22 109.2
 6 102.7  44  72.5  22  93.1  26 115.9  34  83.8  12 113.3
12 109.4 :
CALCULATE LogY = LOG(Y)

" Fit a regression for Y, then for LOG(Y)
  Interrupt the execution to look at the results"
FOR Dum=Y,LogY
   MODEL Dum
   TERMS X
   FIT [PRINT=summary] X
   BREAK 
   RDISPLAY [PRINT=estimates]
   BREAK 
ENDFOR
ENDBREAK
ENDBREAK
ENDBREAK
ENDBREAK
Updated on June 20, 2019

Was this article helpful?