The SET statement performs a variety of arithmetic operations, allowing you to arrange calculations in several steps. In the following example, a series of SET commands makes use of columns and numeric constants to define a group of simple equations.
SET RATE (5.2) = 10.75 SET VALUE (2.2) = 14.22 SET INTRT (2.5) = 14.34721 SET A (2.5) = AVG(14,9,6) SET B (6.0) = (-VALUE * 100) SET SUBTOT (4.5) = (INTRT + 7) / (-16) SET AMT (4.4) = (RATE / INTRT) + (.6392 * VALUE) SET SUM (4.4) = (RATE + A - B) + (SUBTOT + AMT / 5)
After each SET statement is calculated, its value can then be used in the next calculation until the last result has been evaluated. The following represent the results obtained from the previous calculations.
A = 09.66667 B = -001422 SUBTOT = -0001.33420 AMT = 0009.8387 SUM = 1443.0502
The final result SUM contains the value calculated from the last equation involving values from the other SET statements. Such use of nested or connected SET statements permits you considerable flexibility in performing calculations, especially when the standard operators and functions are employed in conjunction with user-defined functions.
|
Copyright © 2014 CA.
All rights reserved.
|
|