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.

<strong>Command</strong>s 9<br />

• Transformation commands (IF, COUNT, COMPUTE, etc.) that are used to create and<br />

modify variables must precede commands that assign labels or missing values to those<br />

variables, and they must also precede the procedures that use those variables.<br />

• Generally, the logical outcome of command processing determines command order. For<br />

example, a procedure that creates new variables in the working data file must precede a<br />

procedure that uses those new variables.<br />

• Some commands, such as REREAD and END CASE, can appear only in an input program<br />

where the cases are created. Other commands, such as SELECT IF, can appear only in a<br />

transformation program after cases have been created. Still other commands, such as<br />

COMPUTE, can appear in an input or transformation program. For a discussion of these<br />

program states and command order, see Appendix A.<br />

In addition to observing the rules above, it is often important to distinguish between commands<br />

that cause the data to be read and those that do not, particularly for large data sources<br />

such as databases. <strong>Command</strong>s that cause the data to be read include all statistical and graphing<br />

commands, all commands that result in creation of new files, AUTORECODE, EXECUTE,<br />

and SORT.<br />

Transformation commands that alter the dictionary of the working data file, such as<br />

MISSING VALUES, and commands that do not affect the working data, such as SET, SHOW,<br />

and DISPLAY, take effect as soon as they are encountered in the command sequence regardless<br />

of conditional statements that precede them. Table 1 lists all transformation commands<br />

that take effect immediately.<br />

Table 1 Transformation commands that take effect immediately<br />

ADD VALUE LABELS PRINT FORMATS<br />

DOCUMENT SPLIT FILE<br />

DROP DOCUMENTS STRING<br />

FORMATS VALUE LABELS<br />

LEAVE VARIABLE LABELS<br />

MISSING VALUES VECTOR<br />

N OF CASES WEIGHT<br />

NUMERIC WRITE FORMATS<br />

Since these transformations take effect regardless of the conditional statements that precede<br />

them, they cannot be applied selectively to individual cases, as shown in the following example:<br />

DO IF AGE>69.<br />

MISSING VALUES INCOME EXPENSES (0).<br />

ELSE.<br />

COMPUTE PROFIT=INCOME-EXPENSES.<br />

END IF.<br />

LIST.<br />

The MISSING VALUES command is in effect when COMPUTE is executed, even if the condition<br />

defined on DO IF is false. To treat 0 income and expenses as missing only for those older

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

Saved successfully!

Ooh no, something went wrong!