SUM Function
Returns the sum of the nonmissing arguments.
Category: |
Descriptive Statistics |
Syntax
Required Argument
argument
specifies a numeric
constant, variable, or expression. If all the arguments have missing
values, then one of the following occurs:
-
If you use only one argument, then
the value of that argument is returned.
-
If you use two or more arguments,
then a standard missing value (.) is returned.
Otherwise, the result
is the sum of the nonmissing values. The argument list can consist
of a variable list, which is preceded by OF.
Example
The following SAS statements
produce these results.
|
|
|
|
|
|
x1=9;
x2=39;
x3=sum(of x1-x2);
|
|
x1=5; x2=6; x3=4; x4=9;
y1=34; y2=12; y3=74; y4=39;
result=sum(of x1-x4, of y1-y5);
|
|
x1=55;
x2=35;
x3=6;
x4=sum(of x1-x3, 5);
|
|
x1=7;
x2=7;
x5=sum(x1-x2);
|
|
y1=20;
y2=30;
x6=sum(of y:);
|
|