PROC SQL calculates
summary functions and outputs results differently, depending on a
combination of factors:
-
whether the summary function specifies
one or more multiple columns as arguments
-
whether the query contains a GROUP
BY clause
-
if the summary function is specified
in a SELECT clause, whether there are additional columns listed that
are outside the summary function
-
whether the WHERE clause, if there
is one, contains only columns that are specified in the SELECT clause.
To count nonmissing
values, use the COUNT summary function.
To select the groups
to be displayed, use a HAVING clause following a GROUP BY clause.
When you use a summary
function in a SELECT clause or a HAVING clause, in some situations,
PROC SQL must remerge data. When PROC SQL remerges data, it makes
two passes through the data, and this requires additional processing
time.