MEAN Function (RMV command)
MEAN
replaces
missing values with the mean of valid surrounding values. The number
of surrounding values used to compute the mean depends on the span.
- The specification on
MEAN
is a variable or variable list and a span, in parentheses. - The span specification is optional and can be any
positive integer or keyword
ALL
. - A span of n uses n valid cases before and after the missing value.
- If span is not specified, it defaults to 2.
- Keyword
ALL
computes the mean of all valid values. -
MEAN
will not replace missing values if there are not enough valid surrounding cases to satisfy the span specification.
Example
RMV B=MEAN(A,3).
- This example produces a new variable called B.
- B will have the same values as variable A but with missing values replaced by means of valid surrounding values.
- Each mean is based on six values—that is, the three nearest valid values on each side of the missing value.