How to: |
SIGN takes a numeric argument and returns the value -1 if the number is negative, 0 (zero) if the number is zero, and 1 if the number is positive.
SIGN(number)
where:
Is a field containing a numeric value or a number.
The following request returns the sign of positive numbers, negative numbers, and zero (0).
TABLE FILE GGSALES SUM DOLLARS NOPRINT AND COMPUTE PLUSDOLL/I9 = IF DOLLARS GT 12000000 THEN DOLLARS ELSE 0; SIGN1/I5 = SIGN(PLUSDOLL); NEGDOLL/I9 = IF DOLLARS LT 12000000 THEN 0 ELSE -DOLLARS; SIGN2/I5 = SIGN(NEGDOLL); BY CATEGORY ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ ENDSTYLE END
The output is shown in the following image.