Arithmetic Operations and Comparisons (MATRIX-END MATRIX command)
The expression on a COMPUTE
statement can be formed from matrix constants and
variables, combined with the arithmetic, relational, and logical operators. Matrix constructions and
matrix functions are also allowed.
Examples
COMPUTE PI = 3.14159265.
COMPUTE RSQ = R * R.
COMPUTE FLAGS = EIGENVAL >= 1.
COMPUTE ESTIM = {OBS, PRED, ERR}.
- The first statement computes a scalar. Note that the braces are optional on a scalar constant.
- The second statement computes the square of the matrix R. R can be any square matrix, including a scalar.
- The third statement computes a vector named FLAGS, which has the same dimension as the existing vector EIGENVAL. Each element of FLAGS equals 1 if the corresponding element of EIGENVAL is greater than or equal to 1, and 0 if the corresponding element is less than 1.
- The fourth statement constructs a matrix ESTIM by concatenating the three vectors or matrices OBS, PRED, and ERR. The component matrices must have the same number of rows.