FACTOR Specification (MATRIX-END MATRIX command)
To write a matrix-format data file with factor
or group codes, you must use the FACTOR
specification to provide a row matrix containing the values of each
of the factors or group variables for the matrix expression being
written by the current MSAVE
statement.
- The factor vector must have the same number of columns
as there are factors in the matrix data file being written. You can
use a scalar when the groups are defined by a single variable. For
example,
FACTOR=1
indicates that the matrix data being written are for the value 1 of the factor variable. - The values of the factor vector are written to the matrix-format data file as values of the factors in the file.
- To create a complete matrix-format data file with
factors, you must execute an
MSAVE
statement for every combination of values of the factors or grouping variables (in other words, for every group). If split-file variables are also present, you must execute anMSAVE
statement for every combination of factor codes within every combination of values of the split-file variables.
Example
MSAVE M11 /TYPE=MEAN /OUTFILE=CORRMAT /VARIABLES=V1 TO V8
/FNAMES=SEX, GROUP /FACTOR={1,1}.
MSAVE S11 /TYPE STDDEV.
MSAVE MAKE(1,8,N(1,1)) /TYPE N.
MSAVE C11 /TYPE CORR.
MSAVE M12 /TYPE=MEAN /FACTOR={1,2}.
MSAVE S12 /TYPE STDDEV.
MSAVE MAKE(1,8,N(1,2)) /TYPE N.
MSAVE C12 /TYPE CORR.
MSAVE M21 /TYPE=MEAN /FACTOR={2,1}.
MSAVE S21 /TYPE STDDEV.
MSAVE MAKE(1,8,N(2,1)) /TYPE N.
MSAVE C21 /TYPE CORR.
MSAVE M22 /TYPE=MEAN /FACTOR={2,2}.
MSAVE S22 /TYPE STDDEV.
MSAVE MAKE(1,8,N(2,2)) /TYPE N.
MSAVE C22 /TYPE CORR.
- The first four
MSAVE
statements provide data for a group defined by the variables SEX and GROUP, with both factors having the value 1. - The second, third, and fourth groups of four
MSAVE
statements provide the corresponding data for the other groups, in which SEX and GROUP, respectively, equal 1 and 2, 2 and 1, and 2 and 2. - Within each group of
MSAVE
statements, a suitable number-of-cases vector is created with the matrix functionMAKE
.