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.

DO IF<br />

DO IF [(]logical expression[)]<br />

transformation commands<br />

[ELSE IF [(]logical expression[)]]<br />

transformation commands<br />

[ELSE IF [(]logical expression[)]]<br />

.<br />

.<br />

.<br />

[ELSE]<br />

transformation commands<br />

END IF<br />

The following relational operators can be used in logical expressions:<br />

Symbol Definition Symbol Definition<br />

EQ or = Equal to NE or *<br />

Not equal to<br />

LT or < Less than LE or Greater than GE or >= Greater than or equal to<br />

* On ASCII systems (for example, UNIX, VAX, and all PC’s), you can also use ~=;<br />

on IBM EBCDIC systems (for example, IBM 360 and IBM 370), you can also use ¬=.<br />

The following logical operators can be used in logical expressions:<br />

Symbol Definition<br />

AND or & Both relations must be true<br />

OR or | Either relation can be true<br />

NOT *<br />

Reverses the outcome of an expression<br />

* On ASCII systems, you can also use ~; on IBM EBCDIC systems,<br />

you can also use ¬ (or the symbol above number 6).<br />

Example<br />

DO IF (YRHIRED GT 87).<br />

COMPUTE BONUS = 0.<br />

ELSE IF (DEPT87 EQ 3).<br />

COMPUTE BONUS = .1*SALARY87.<br />

ELSE IF (DEPT87 EQ 1).<br />

COMPUTE BONUS = .12*SALARY87.<br />

ELSE IF (DEPT87 EQ 4).<br />

COMPUTE BONUS = .08*SALARY87.<br />

ELSE IF (DEPT87 EQ 2).<br />

COMPUTE BONUS = .14*SALARY87.<br />

END IF.<br />

492

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

Saved successfully!

Ooh no, something went wrong!