27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

BREAK<br />

BREAK<br />

Overview<br />

BREAK controls looping that cannot be fully controlled with IF clauses. Generally, BREAK<br />

is used within a DO IF—END IF structure. The expression on the DO IF command specifies<br />

the condition in which BREAK is executed.<br />

Basic Specification<br />

• The only specification is keyword BREAK. There are no additional specifications.<br />

• BREAK must be specified within a loop structure. Otherwise, an error results.<br />

Operations<br />

Example<br />

• A BREAK command inside a loop structure but not inside a DO IF—END IF structure<br />

terminates the first iteration of the loop for all cases, since no conditions for BREAK<br />

are specified.<br />

• A BREAK command within an inner loop terminates only iterations in that structure, not<br />

in any outer loop structures.<br />

VECTOR #X(10).<br />

LOOP<br />

+ DATA LIST<br />

#I = 1 TO #NREC.<br />

NOTABLE/ #X1 TO #X10 1-20.<br />

+ LOOP #J = 1 TO 10.<br />

+ DO IF SYSMIS(#X(#J)).<br />

+ BREAK.<br />

+ END IF.<br />

+ COMPUTE X = #X(#J).<br />

+ END CASE.<br />

+ END LOOP.<br />

END LOOP.<br />

• The inner loop terminates when there is a system-missing value for any of the variables<br />

#X1 to #X10.<br />

• The outer loop continues until all records are read.<br />

169

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!