MATRIX-END MATRIX

The MATRIX and END MATRIX commands enclose statements that are executed by the matrix processor. Using matrix programs, you can write your own statistical routines in the compact language of matrix algebra. Matrix programs can include mathematical calculations, control structures, display of results, and reading and writing matrices as character files or data files.

MATRIX

matrix statements

END MATRIX

The following matrix language statements can be used in a matrix program: BREAK, CALL, COMPUTE, DISPLAY, DO IF, ELSE, ELSE IF, END IF, END LOOP, GET, LOOP, MGET, MSAVE, PRINT, READ, RELEASE, SAVE, WRITE.

For information on which functions can be used in matrix language statements, see Matrix Functions (MATRIX-END MATRIX command).

Example

MATRIX.
READ A /FILE=MATRDATA /SIZE={6,6} /FIELD=1 TO 60.
CALL EIGEN(A,EIGENVEC,EIGENVAL).
LOOP J=1 TO NROW(EIGENVAL).
+ DO IF (EIGENVAL(J) > 1.0).
+   PRINT EIGENVAL(J) / TITLE="Eigenvalue:" /SPACE=3.
+   PRINT T(EIGENVEC(:,J)) / TITLE="Eigenvector:" /SPACE=1.
+ END IF.
END LOOP.
END MATRIX.

Release History

Statistics 27.0
  • The NCDF.BETA cumulative distribution function is now supported.
  • Probability density functions are now supported (they were previously only supported by the COMPUTE command).
  • Tail probability functions are now supported (they were previously only supported by the COMPUTE command).
  • Random variable functions are now supported (they were previously only supported by the COMPUTE command).
Subscription November 2017 update / Statistics 26.0
  • Long variable names (up to 64 bytes) can be used to name a matrix or vector name (such as COMPUTE, CALL, PRINT, READ, WRITE, GET, SAVE, MGET, MSAVE, DISPLAY, RELEASE, and so on).
  • Variable names that are included in a vector or matrix object are truncated to 8 bytes. This is because the matrix/vector structure is an array of numbers, and each number can match a string only up to 8 bytes. Long names (up to 64 bytes) are supported only when explicitly specified.
  • Long variable names are supported in GET and SAVE commands when explicitly specified on the /VARIABLES subcommand (and when specified on the /STRINGS subcommand for the SAVE command). Variable names for GET and SAVE commands are truncated to 8 bytes when they are referenced through a vector in the /NAMES subcommand.
  • The GET, SAVE, MGET, or MSAVE statements support both dataset references and physical file specifications.
  • MATRIX-END MATRIX supports statistical functions that were previously only supported by the COMPUTE command (for example IDF.CHISQ, CDF.NORMAL, NCDF.F, and so on). For more information, see Matrix Functions (MATRIX-END MATRIX command).