LOG: Calculating the Natural Logarithm

How to:

The LOG function returns the natural logarithm of a number.

Syntax: How to Calculate the Natural Logarithm

LOG(in_value)

where:

in_value

Numeric

Is the value for which the natural logarithm is calculated, the name of a field that contains the value, or an expression that returns the value. If you supply an expression, use parentheses as needed to ensure the correct order of evaluation. If in_value is less than or equal to 0, LOG returns 0.

Example: Calculating the Natural Logarithm

LOG calculates the logarithm of the CURR_SAL field:

TABLE FILE EMPLOYEE
PRINT CURR_SAL AND COMPUTE
LOG_CURR_SAL/D12.2 = LOG(CURR_SAL);BY LAST_NAME BY FIRST_NAME
WHERE DEPARTMENT EQ 'PRODUCTION';
END

The output is:

LAST_NAME        FIRST_NAME         CURR_SAL     LOG_CURR_SAL 
---------        ----------         --------     ------------ 
BANNING          JOHN             $29,700.00            10.30 
IRVING           JOAN             $26,862.00            10.20 
MCKNIGHT         ROGER            $16,100.00             9.69 
ROMANS           ANTHONY          $21,120.00             9.96 
SMITH            RICHARD           $9,500.00             9.16 
STEVENS          ALFRED           $11,000.00             9.31