Numeric (Advanced) Operators
Abs
returns the absolute
value of the input value.
For example,
Abs(-3)
returns
3.
Ceil
rounds the input value
up to the nearest integer.
For example,
Ceil(4.2)
returns
5 and
Ceil(–4.8)
returns -4.
Exp
raises the constant e to
the power specified by the input value.
For example,
Exp(5)
returns
e to
the 5th power (148.41).
Floor
rounds the input value
down to the nearest integer.
For example,
Floor(4.8)
returns
4 and
Floor(-4.2)
returns -5.
Ln
returns the natural
logarithm (base e) of the input value.
For example,
Ln(10)
returns
the
eth root of 10 (2.30...).
Log
returns the logarithm
of the first value, where the second value specifies the base.
For example,
64
Log 8
returns the base 8 logarithm of 64 (2).
Mod
returns the remainder
after dividing the first value by the second value.
For example,
5
Mod 2
returns 1.
Power
raises the first value
to the power of the second value.
For example,
5
Power 2
returns 5 to the 2nd power (25).
Root
returns the nth
root of the first value, where the second value specifies n (the
base of the root).
For example,
27
Root 3
returns the 3rd (cube) root of 27 (3).
Round
rounds the first value
to the number of decimal places that is specified by the second value.
Select the second value from the drop-down list.
For example,
7.354
Round 2
returns 7.35.
Note: If you select 0 decimal places,
then the values are rounded to the nearest integer.
TreatAs
allows a numeric, date,
or datetime value to be used as a different data type within other
operators. Select one of the following:
_Date_
allows the value to
be used as a date.
_Datetime_
allows the value to
be used as a datetime value.
_Number_
allows the value to
be used as a number.
_Time_
allows the value to
be used as a time value.
The value is treated
as a raw value instead of being converted. Date values are the number
of days since 01JAN1960. Datetime values are the number of seconds
since 01JAN1960. Time values are the number of seconds since midnight.
For example,
TreatAs(_Date_,
19600)
returns 30AUG2013 as a date value.
Note: The TreatAs operator is useful
for calculating elapsed time between two datetime values. For example,
(TreatAs(_Number_, '23OCT2013'd)
— TreatAs(_Number_, '15JAN2013'd))
calculates
the number of days between 15JAN and 23OCT, which is 281.
Trunc
truncates the input
value to an integer.
For example,
Trunc(8.9)
returns
8 and
Trunc(-8.9)
returns -8.
Copyright © SAS Institute Inc. All rights reserved.