POWER: Raising a Value to a Power

How to:

POWER raises a base value to a power.

Syntax: How to Raise a Value to a Power

POWER(base, power)

where:

base

Numeric

Is the value to raise to a power. The output value has the same data type as the base value. If the base value is integer, negative power values will result in truncation.

power

Numeric

Is the power to which to raise the base value.

Example: Raising a Base Value to a Power

In the following request, POWER returns the value COGS_US/20.00 raised to the power stored in DAYSDELAYED:

DEFINE FILE WFLITE
BASE=COGS_US/20.00;
POWER1= POWER(COGS_US/20.00,DAYSDELAYED);
END
TABLE FILE WFLITE
PRINT BASE IN 15 DAYSDELAYED POWER1
BY PRODUCT_CATEGORY
WHERE PRODUCT_CATEGORY EQ 'Computers'
WHERE DAYSDELAYED NE 0
ON TABLE SET PAGE NOPAGE
END

Partial output follows:

  Product                              Days         
  Category                BASE         Delayed          POWER1  
  --------                ----         -------          ------  
  Computers              12.15               3        1,793.61
                         16.70               2          278.89
                          8.35               1            8.35
                          8.10               2           65.61
                          4.05               1            4.05
                          4.05               2           16.40
                          4.05               4          269.04
                          8.35               1            8.35
                         16.70               1           16.70
                          8.35               3          582.18
                          8.35               1            8.35
                          4.05               1            4.05
                          4.05               1            4.05
                          8.35               4        4,861.23
                          8.35              -1             .12
                          8.35               1            8.35
                          8.35               3          582.18