|
I'm running some computations on an SPSS matrix-format file that has
seven split-file groups. I'm having difficulty saving the output matrices from the seven groups to a single file. I'm assuming that a separate MSAVE statement will be required for each split-file group, so I'm trying to use MSAVE like this: msave newA1 /type = cov /outfile = 'c:\outfile.sav' /variables = var1, var2, var3, var4 /split = 1 /snames = group . msave newA2 /type = cov /split = 2. Where newA1 and newA2 are the output matrices for the first two split-file groups. This is producing a catastrophic error and crashing the processor. So, clearly this isn't the right way. Anyone have experience using MSAVE with split-file? Dan R. -- Daniel Robertson Senior Research and Planning Associate Institutional Research and Planning Cornell University, Ithaca NY 14853-2801 607.255.9642 / irp.cornell.edu |
|
Hi Daniel
You don't give much detail, therefore my advise is going to be very vague. Have you read the syntax guide chpater dedicated to MATRIX. It says that when split file is on, then you have to run MATRIX in batch mode. See below an example (the only one I've got that mixes MATRIX, split file on and MSAVE). I have stripped the code of all the intermediate calculations (Bartlett's homogeneity of variances tests and other stuff) and left only the input data and the MSAVE to transform them in matrix file data. As you can see, you don't need to indicate /SPLIT=1, SPLIT=2... If you have a variable with the split groups values (in my codes is named varnum), ten just indicate /SPLIT=varnum, and MATRIX will authomatically cicle through all the possible values. If you need more help, please post more of your code and I'll do my best. Regards, Marta Garcia-Granero * A) This part (from MATRIX to END MATRIX) must be saved to disk ("C:\Temp\MatrixCode.sps") *. MATRIX. * Import DATA *. GET varnum /VAR=varnum. GET names/VAR=groups. GET n/VAR=n. GET mean/VAR=mean. GET sd/VAR=sd. COMPUTE k=NROW(n). . * Some intermediate code eliminated *. . * Writing DATA in MATRIX DATA format (several MSAVE are used, but this is because there are different data to save, means, sd & n for each split group) *. COMPUTE group=T({1:k}). MSAVE mean /TYPE=MEAN /FNAMES=group /FACTOR=group /VARIABLE=depvar /SNAMES=varnum /SPLIT=varnum /OUTFILE=*. MSAVE sd /TYPE=STDDEV /FNAMES=group /FACTOR=group /VARIABLE=depvar /SNAMES=varnum /SPLIT=varnum /OUTFILE=*. MSAVE n /TYPE=N /FNAMES=group /FACTOR=group /VARIABLE=depvar /SNAMES=varnum /SPLIT=varnum /OUTFILE=*. PRINT /TITLE='Matrix data saved to current data file'. END MATRIX. * B) Sample dataset (two split groups) *. DATA LIST LIST/ varnum(F4.0) groups(A8) n(F5.0) mean(F8.1) sd(F8.3). BEGIN DATA 1 Control 10 62.8 6.9730 1 Respir 10 70.2 6.2147 1 Metabol 10 79.4 6.2397 1 Mixed 10 80.2 6.1065 2 Control 15 72.8 7.7703 2 Respir 15 80.4 7.3174 2 Metabol 15 89.4 7.4379 2 Mixed 15 90.2 8.1056 END DATA. * Now we split the data *. SPLIT FILE LAYERED BY varnum. * Using the MATRIX code with split file on *. INCLUDE "C:\Temp\MatrixCode.sps". * Instead of INCLUDE, you can use INSERT *. INSERT FILE="C:\Temp\SummaryANOVA.sps" SYNTAX=BATCH. > I'm running some computations on an SPSS matrix-format file that has > seven split-file groups. I'm having difficulty saving the output > matrices from the seven groups to a single file. I'm assuming that a > separate MSAVE statement will be required for each split-file group |
| Free forum by Nabble | Edit this page |
