SQRT: Calculating the Square Root

How to:

Available Languages: reporting, Maintain

The SQRT function calculates the square root of a number.


Top of page

x
Syntax: How to Calculate the Square Root
SQRT(in_value)

where:

in_value

Numeric

Is the value for which the square root 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 you supply a negative number, the result is zero.



Example: Calculating the Square Root

SQRT calculates the square root of LISTPR:

TABLE FILE MOVIES
PRINT LISTPR AND COMPUTE
SQRT_LISTPR/D12.2 = SQRT(LISTPR);BY TITLE
WHERE CATEGORY EQ 'MUSICALS';
END

The output is:

TITLE                              LISTPR      SQRT_LISTPR
-----                              ------      -----------
ALL THAT JAZZ                       19.98             4.47
CABARET                             19.98             4.47
CHORUS LINE, A                      14.98             3.87
FIDDLER ON THE ROOF                 29.95             5.47

WebFOCUS