User Tools

Site Tools


summ_summation_of_a_set_.htm
Navigation:  Templates > Guide to all Templates > Additional Libraries and Templates > Statistics Library >====== SUMM (summation of a set) ====== Previous pageReturn to chapter overviewNext page

SUMM(dataset)

blk2blue.jpg

SUMM Returns the summation of all of a data set's values.
dataset The label of a QUEUE with its first component field defined as a REAL.

SUMM computes the summation of all of a data set's values. The function operates on the numeric set defined by all the entries in the first component of the designated QUEUE (dataset). The computation is a significant factor in several statistical formulas.

NoteBox.jpg

The passed data set does not have to be sorted. The function copies the passed set. The passed data set is unchanged.

Return DataType:     REAL

Example:

StatSetXY       QUEUE,PRE()

X                REAL

               END

SummationOfSet      REAL

CODE

FREE(StatSetX)                     !free the QUEUE

CLEAR(STADAT:RECORD)               !clear the record buffer

STADAT:Id = STA:Id                 !prime the record buffer

STADAT:ItemNumber = 1

SET(STADAT:KeyIdItemNumber,STADAT:KeyIdItemNumber !position file pointer

LOOP                               !load the QUEUE

  NEXT(StatisticsData)             !read next record

  IF ERRORCODE() OR STADAT:Id NOT = STA:Id

    BREAK

  ELSE

    StatSetX:X = STADAT:X          !load the QUEUE buffer

    ADD(StatSetX)                  !add to the QUEUE

  END

END

SummationOfSet = SUMM(StatSetX)    !call SUMM

summ_summation_of_a_set_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1