MSAVE Statement: Writing Matrix Data Files (MATRIX-END MATRIX command)

The MSAVE statement writes matrix expressions to a matrix-format data file that can be used as matrix input to other procedures. (See MATRIX DATA for a discussion of matrix-format data files.) The syntax of MSAVE is as follows:

MSAVE matrix expression
   /TYPE = {COV   }
           {CORR  }
           {MEAN  }
           {STDDEV}
           {N     }
           {COUNT }
  [/OUTFILE = 'filespec']
  [/VARIABLES = variable list]
  [/SNAMES = variable list]
  [/SPLIT = split vector]
  [/FNAMES = variable list]
  [/FACTOR = factor vector]
  • Only one matrix-format data file can be saved in a single matrix program.
  • Each MSAVE statement writes records of a single rowtype. Therefore, several MSAVE statements will normally be required to write a complete matrix-format data file.
  • Most specifications are retained from one MSAVE statement to the next so that it is not necessary to repeat the same specifications on a series of MSAVE statements. The exception is the FACTOR specification, as noted below.

Example

MSAVE M /TYPE=MEAN /OUTFILE=CORRMAT /VARIABLES=V1 TO V8.
MSAVE S /TYPE STDDEV.
MSAVE MAKE(1,8,24) /TYPE N.
MSAVE C /TYPE CORR.
  • The series of MSAVE statements save the matrix variables M, S, and C, which contain, respectively, vectors of means and standard deviations and a matrix of correlation coefficients. The matrix-format data file thus created is suitable for use in a procedure such as FACTOR.
  • The first MSAVE statement saves M as a vector of means. This statement specifies OUTFILE, a previously defined file handle, and VARIABLES, a list of variable names to be used in the IBM® SPSS® Statistics data file.
  • The second MSAVE statement saves S as a vector of standard deviations. Note that the OUTFILE and VARIABLES specifications do not have to be repeated.
  • The third MSAVE statement saves a vector of case counts. The matrix function MAKE constructs an eight-element vector with values equal to the case count (24 in this example).
  • The last MSAVE statement saves C, an 8 × 8 matrix, as the correlation matrix.