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.

1650 VARSTOCASES<br />

The command:<br />

VARSTOCASES<br />

/MAKE newvar FROM var1 TO var4.<br />

creates a new variable, newvar, using the values of var1 through var4. The LIST output for<br />

the new working file is as follows:<br />

caseid newvar<br />

001 .00<br />

001 .05<br />

001 5.00<br />

001 3.00<br />

002 7.00<br />

002 1.00<br />

002 5.00<br />

002 4.00<br />

003 6.00<br />

003 3.00<br />

003 6.00<br />

003 2.00<br />

The values for the new variable newvar are the values from var1 through var4 from the<br />

original data. There are now four rows for each case—one row for each variable that was<br />

named on the FROM list.<br />

MAKE Subcommand<br />

The MAKE subcommand names, and optionally labels, the new variable to be created from<br />

the variables on the FROM list.<br />

• One new variable is required on each MAKE subcommand. It must have a unique name.<br />

• The label for the new variable is optional and, if specified, must be delimited by<br />

apostrophes or quotation marks.<br />

• The new variable will have the values of the variables listed on the FROM list. For each<br />

case in the original data, one new row will be created for each variable on the FROM list.<br />

• All of the variables on the FROM list are required to be of the same type. For example,<br />

they must all be numeric or they must all be string.<br />

• The dictionary information for the new variable (for example, value labels and format) is<br />

taken from the first variable in the FROM list. If string variables of different lengths are<br />

specified, the longest length is used.<br />

• Rows are created in the order in which variables appear on the FROM list.<br />

• Variables that appear on the FROM list will not appear in the new data file.<br />

• Variables that are kept in the new data file and not named on the FROM list will have their<br />

values propagated for each new row.<br />

• When multiple MAKE subcommands are used, a variable may not appear on more than one<br />

FROM list.<br />

• A variable may be listed more than once on a FROM list. Its values are repeated.<br />

• When multiple MAKE subcommands are used, the FROM lists must all contain the same<br />

number of variables (variables that are listed more than once must be included in the<br />

count).

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

Saved successfully!

Ooh no, something went wrong!