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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VECTOR<br />

VECTOR {vector name=varlist } [/vector name...]<br />

{vector name(n [format])}<br />

Example<br />

VECTOR V=V1 TO V6.<br />

STRING SELECT(A1).<br />

COMPUTE SELECT=’V’.<br />

LOOP #I=1 TO 6.<br />

IF MISSING(V(#I)) SELECT=’M’.<br />

END LOOP.<br />

Overview<br />

Options<br />

VECTOR associates a vector name with a set of existing variables or defines a vector of new<br />

variables. A vector is a set of variables that can be referred to using an index. The vector can<br />

refer to either string or numeric variables, and the variables can be permanent or temporary.<br />

For each variable in the reference list, VECTOR generates an element. Element names are<br />

formed by adding a subscript in parentheses to the end of the vector name. For example, if<br />

vector AGES has three elements, the element names are AGES(1), AGES(2), and AGES(3).<br />

Although the VECTOR command has other uses within the transformation language, it is<br />

most often used with LOOP structures because the indexing variable on LOOP can be used<br />

to refer to successive vector elements.<br />

File Structures. VECTOR can be used with the END CASE command to restructure data files.<br />

You can build a single case from several cases or, conversely, you can build several cases<br />

from a single case (see pp. 509 and 510 in Volume I for examples).<br />

Short-Form Vectors. VECTOR can be used to create a list of new variables and the vector that<br />

refers to them simultaneously. VECTOR in the short form can be used to establish the dictionary<br />

order of a group of variables before they are defined on a DATA LIST command. (See<br />

“VECTOR: Short Form” on p. 1657.)<br />

Basic Specification<br />

• The basic specification is VECTOR, a vector name, a required equals sign, and the list of<br />

variables that the vector refers to. The TO keyword must be used to specify the variable list.<br />

• For the short form of VECTOR, the basic specification is VECTOR, an alphabetical prefix,<br />

and, in parentheses, the number of variables to be created.<br />

1655

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

Saved successfully!

Ooh no, something went wrong!