Language Reference |

**sums all elements**

**SUM(***matrix1<, matrix2,..., matrix15>***)**

where *matrix* is a numeric matrix or literal.

The SUM function returns as a single numeric value the sum of all the elements in all arguments. There can be as many as 15 argument matrices. The SUM function checks for missing values and does not include them in the accumulation. It returns 0 if all values are missing.

For example, consider the following statements:

a={2 1, 0 -1}; b=sum(a);These statements return the following scalar:

B 1 row 1 col (numeric) 2

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