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.

Example<br />

Example<br />

Example<br />

IF (AGE > 20 AND SEX = 1) GROUP=2.<br />

IF 739<br />

• The numeric variable GROUP is set to 2 for cases where AGE is greater than 20 and SEX<br />

is equal to 1.<br />

• When the expression is false or missing, the value of GROUP remains unchanged. If<br />

GROUP has not been previously defined, it contains the system-missing value.<br />

IF (SEX EQ ’F’) EEO=QUOTA+GAIN.<br />

• The logical expression tests the string variable SEX for the value F.<br />

• When the expression is true (when SEX equals F), the value of the numeric variable EEO<br />

is assigned the value of QUOTA plus GAIN. Both QUOTA and GAIN must be previously<br />

defined numeric variables.<br />

• When the expression is false or missing (for example, if SEX equals F), the value of EEO<br />

remains unchanged. If EEO has not been previously defined, it contains the system-missing<br />

value.<br />

COMPUTE V3=0.<br />

IF ((V1-V2) LE 7) V3=V1**2.<br />

• COMPUTE assigns V3 the value 0.<br />

• The logical expression tests whether V1 minus V2 is less than or equal to 7. If it is, the<br />

value of V3 is assigned the value of V1 squared. Otherwise, the value of V3 remains at 0.<br />

Example<br />

Example<br />

IF (ABS(A-C) LT 100) INT=100.<br />

• IF tests whether the absolute value of the variable A minus the variable C is less than 100.<br />

If it is, INT is assigned the value 100. Otherwise, the value is unchanged. If INT has not<br />

been previously defined, it is system-missing.<br />

IF (MEAN(V1 TO V5) LE 7) INDEX=1.<br />

• If the mean of variables V1 through V5 is less than or equal to 7, INDEX equals 1.

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

Saved successfully!

Ooh no, something went wrong!