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.

514 END CASE<br />

Example<br />

Figure 4 LIST output when END CASE is specified<br />

HEAD1 HEAD2 INDIV<br />

A C 9.1<br />

C C 3.5<br />

C C 4.3<br />

B A 3.4<br />

B B 4.2<br />

B B 9.6<br />

B B 3.7<br />

Figure 5 LIST output when END CASE is not specified<br />

HEAD1 HEAD2 INDIV<br />

A C 9.1<br />

C C 4.3<br />

X X .<br />

B A 3.4<br />

B B 3.7<br />

* Note: the following is an erroneous program! The COMPUTE and<br />

PRINT commands that follow END CASE are misplaced. They should<br />

be specified after the END INPUT PROGRAM command.<br />

INPUT PROGRAM.<br />

DATA LIST /#X1 TO #X3 (3(F1,1X)).<br />

VECTOR V=#X1 TO #X3.<br />

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

COMPUTE X=V(#I).<br />

END CASE.<br />

END LOOP.<br />

COMPUTE Y=X**2. /* This should be specified after the input program<br />

VARIABLE LABELS X ’TEST VARIABLE’ Y ’SQUARE OF X’.<br />

PRINT FORMATS X Y (F2).<br />

END INPUT PROGRAM.<br />

BEGIN DATA<br />

2 1 1<br />

3 5 1<br />

END DATA.<br />

FREQUENCIES VARIABLES=X Y.<br />

• No error or warning is issued for these commands, but the result is not what was intended.<br />

The computed value for X is passed out of the input program when the END CASE command<br />

is encountered. Thus, Y is computed from the initialized value of X, which is the<br />

system-missing value. As Figure 6 shows, all six cases computed for Y within the input<br />

program have the system-missing value, represented by a period (.).

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

Saved successfully!

Ooh no, something went wrong!