N Function

Returns the number of nonmissing numeric values.

Category: Descriptive Statistics

Syntax

Required Argument

argument

specifies a numeric constant, variable, or expression. At least one argument is required. The argument list can consist of a variable list, which is preceded by OF.

Comparisons

The N function counts nonmissing values, whereas the NMISS and the CMISS functions count missing values. N requires numeric arguments, whereas CMISS works with both numeric and character values.

Example

The following SAS statements produce these results.
SAS Statement
Result
x1=n(1,0,.,2,5,.);
4
x2=n(1,2);
2
x3=n(of x1-x2);
2