MATRIX Subcommand (NONPAR CORR command)

MATRIX writes matrix materials to a matrix data file. The matrix materials always include the number of cases that are used to compute each coefficient, and the materials include either the Spearman or the Kendall correlation coefficient for each variable, whichever is requested. See the topic Format of the Matrix Data File (NONPAR CORR command) for more information.

  • You cannot write both Spearman’s and Kendall’s coefficients to the same matrix data file. To obtain both Spearman’s and Kendall’s coefficients in matrix format, specify separate NONPAR CORR commands for each coefficient and define different matrix data files for each command.
  • If PRINT=BOTH is in effect, NONPAR CORR displays a matrix in the listing file for both coefficients but writes only the Spearman coefficients to the matrix data file.
  • NONPAR CORR cannot write matrix materials for rectangular matrices (variable lists containing keyword WITH). If more than one variable list is specified, only the last variable list that does not use keyword WITH is written to the matrix data file.
  • The specification on MATRIX is keyword OUT and a quoted file specification or previously declared dataset name (DATASET DECLARE command), enclosed in parentheses.
  • If you want to use a correlation matrix that is written by NONPAR CORR in another procedure, change the ROWTYPE_ value RHO or TAUB to CORR by using the RECODE command.
  • Any documents that are contained in the active dataset are not transferred to the matrix file.

OUT ('savfile'|'dataset'). Write a matrix data file or dataset. Specify either a filename, a previously declared dataset name, or an asterisk, enclosed in parentheses. Filenames should be enclosed in quotes and are stored in the working directory unless a path is included as part of the file specification. If you specify an asterisk (*), the matrix data file replaces the active dataset.

Multiple nonparametric correlation tables

NONPAR CORR 
  VARIABLES=PRESTIGE SPPRES PAPRES16 DEGREE PADEG MADEG
  /PRESTIGE TO DEGREE /PRESTIGE WITH DEGREE
  /MATRIX OUT('/data/npmat.sav').
  • Only the matrix for PRESTIGE to DEGREE is written to the matrix data file because it is the last variable list that does not use keyword WITH.