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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

938 MATRIX—END MATRIX<br />

• The first PRINT subcommand uses the default format with as the multiplier for each<br />

element of the matrix. This results in the following output:<br />

Default format<br />

10 ** 9 X<br />

.000000000 .000000002 3.690000000<br />

Note that the first element is displayed as 0 and the second is rounded to one significant<br />

digit.<br />

• An explicitly specified exponential format on the second PRINT subcommand allows each<br />

element to be displayed with full precision, as the following output shows:<br />

Explicit exponential format<br />

1.3570000E-10 2.4680000E+00 3.6900000E+09<br />

Matrix Control Structures<br />

The matrix language includes two structures that allow you to alter the flow of control within<br />

a matrix program.<br />

• The DO IF statement tests a logical expression to determine whether one or more subsequent<br />

matrix statements should be executed.<br />

• The LOOP statement defines the beginning of a block of matrix statements that should<br />

be executed repeatedly until a termination criterion is satisfied or a BREAK statement is<br />

executed.<br />

These statements closely resemble the DO IF and LOOP commands in the SPSS transformation<br />

language. In particular, these structures can be nested within one another as deeply as<br />

the available memory allows.<br />

DO IF Structures<br />

A DO IF structure in a matrix program affects the flow of control exactly as the analogous<br />

commands affect an SPSS transformation program, except that missing-value considerations<br />

do not arise in a matrix program. The syntax of the DO IF structure is as follows:<br />

DO IF [(]logical expression[)]<br />

matrix statements<br />

[ELSE IF [(]logical expression[)]]<br />

matrix statements<br />

[ELSE IF...]<br />

.<br />

.<br />

.<br />

[ELSE]<br />

matrix statements<br />

END IF.<br />

10 9

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

Saved successfully!

Ooh no, something went wrong!