The ABS function in ProBuilder language is used to calculate the absolute value of a given number. The absolute value of a number is its non-negative value without regard to its sign. This function is particularly useful in financial and mathematical calculations where only the magnitude of a number is important, irrespective of its direction (positive or negative).
ABS(expression)
Where expression is the numerical value or formula for which the absolute value is to be computed.
Consider a scenario where you need to find the absolute value of the result of a division between two variables, var1 and var2.
var1 = -12
var2 = 5
myresult = var1 / var2
myABSresult = ABS(var1 / var2)
RETURN myresult AS "not absolute value", myABSresult AS "absolute value"
In this example:
myresult will hold the value -2.4, which is the direct result of the division of var1 by var2.myABSresult will hold the value 2.4, which is the absolute value of the result of the division, effectively removing the negative sign.This function is straightforward but very powerful when dealing with calculations that require non-negative inputs or when the sign of a number is not relevant to the analysis being performed.