SIGN Function

Returns the sign of a value.

Category:Mathematical

Syntax

SIGN(argument)

Required Argument

argument

specifies a numeric constant, variable, or expression.

Details

The SIGN function returns the following values:

-1

if argument < 0

0

if argument = 0

1

if argument > 0.

Example

data new;                                                                                                                               
   x=sign(-5);                                                                                                                            
   y=sign(5);                                                                                                                             
   z=sign(0);                                                                                                                             
   put x= y= z=;                                                                                                                          
run;

These statements produce these results:

x=-1 y=1 z=0
Last updated: April 14, 2026