BREAK
    

BREAK

Transfers control from within a DO- or WHILE-loop to the command immediately following the end of the loop. Thus BREAK breaks out of the loop. Here is a simple example using a global macro.

GMACRO 
NOMISS 
#
# Takes data from the column named X. Finds the first missing 
# observation. Then deletes all observations starting with the 
# first missing to the end of the column. 
# Constants K90 and K91 are used for scratch work 
#   
LET K90 = COUNT('X') 
DO K91 = 1:K90 
  IF  'X'(K91) = '*' 
    BREAK 
  ENDIF 
ENDDO 
DELETE  K91:K90 'X' 
ENDMACRO

The program goes through the values of X until it finds a missing value. It then leaves the loop and goes to the statement following ENDDO--in this example, DELETE.

Note that this program does not handle the case when X has no missing values correctly. We will fix this when we discuss the command EXIT.