27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

950 MATRIX—END MATRIX<br />

• If more than one SAVE statement writes to the working data file in a single matrix program,<br />

the dictionary of the new working data file is written on the basis of the information given<br />

by the first such SAVE. All the subsequently saved matrices are appended to the new<br />

working data file as additional cases. If the number of columns differs, an error occurs.<br />

• When you execute a matrix program with the INCLUDE command, the SAVE statement<br />

creates a new SPSS data file at the end of the matrix program’s execution, so any attempt<br />

to GET the data file obtains the original data file, if any.<br />

• When you execute a matrix program from a syntax window, SAVE creates a new SPSS data<br />

file immediately, but the file remains open, so you cannot GET it until after the END MATRIX<br />

statement.<br />

VARIABLES Specification<br />

You can provide variable names for the SPSS data file with the VARIABLES specification.<br />

The variable list is a list of valid SPSS variable names separated by commas.<br />

• You can use the TO convention, as shown in the example below.<br />

• You can also use the NAMES specification, discussed below, to provide variable names.<br />

Example<br />

SAVE {A,B,X,Y} /OUTFILE=*<br />

/VARIABLES = A,B,X1 TO X50,Y1,Y2.<br />

• The matrix expression on the SAVE statement constructs a matrix from two column vectors<br />

A and B and two matrices X and Y. All four matrix variables must have the same number of<br />

rows so that this matrix construction will be valid.<br />

• The VARIABLES specification provides descriptive names so that the SPSS variable names<br />

in the new working data file will resemble the names used in the matrix program.<br />

NAMES Specification<br />

As an alternative to the explicit list on the VARIABLES specification, you can specify a name<br />

list with a matrix expression that evaluates to a vector containing string values. The elements<br />

of this vector are used as names for the variables.<br />

• The NAMES specification on SAVE is designed to complement the NAMES specification on<br />

the GET statement. Names extracted from an SPSS data file can be used in a new data file<br />

by specifying the same vector name on both NAMES specifications.<br />

• If you specify both VARIABLES and NAMES, a warning message is displayed and the<br />

VARIABLES specification is used.<br />

• If you omit both the VARIABLES and NAMES specifications, or if you do not specify names<br />

for all columns of the matrix, the MATRIX procedure creates default names. The names have<br />

the form COLn, where n is the column number.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!