AVG

Contents


avg allows you to find the average of a series of numeric variables.

 

Syntax

   avg (exprg_list)

 

Parameters

Element

Description

Remarks

exprg_list

List of generalized_expressions separated by a comma (,)

All expressions must be numeric.

Examples

   # Average of several numeric expressions
    CA_MOYEN = avg( CA_MENSUEL(1..12) )

 

Description and Comments

avg allows you to calculate the average of any number of variables or numeric expressions, i.e., their sum divided by the
number of elements in the list.
You can mix description, decimal, integer, floating, and dual-precision variables.
The type of result depends on the type of parameters and how great the result is. It may be Integer if all elements are
of the Integer type and if the sum is divisible by the number of elements; Double if there is at least one Double in the series of parameters; Decimal
in other cases.
If one of the function's parameters is a variable that was sized with no index or index interval precision, then all of the variable's
elements are used. The precision of an index or of an index interval determines the elements to be considered.
If you give an index interval since there is not a single element for which you can calculate the average, e.g., avg(VALEURS(1..0)), the
result returned is zero (0).

 

Associated Errors

Error

Description

ERMODE (10)

- The indexes given are not numeric.
- One of the parameters is not numeric.

ERINDI (8)

Range Error for Indexes

ERDOM (50)

The parameters are not numeric.

ERDIM (55)

Too many dimensions given

 

Associated Keywords

MIN - MAX - SUM - PRD - VAR - UNI - FIND


CONTENTS


Copyright © Sage 1999 - 2007