Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Language Reference

CUSUM Function

calculates cumulative sums

CUSUM( matrix)

where matrix is a numeric matrix or literal.

The CUSUM function returns a matrix of the same dimension as the argument matrix. The result contains the cumulative sums obtained by scanning the argument and summing in row-major order.

For example, the statements

   a=cusum({1 2 4 5});
   b=cusum({5 6, 3 4});
produce the result
             A             1 row       4 cols    (numeric)

                        1         3         7        12


             B             2 rows      2 cols    (numeric)

                                  5        11
                                 14        18

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.