Output 2.31 Using a WHERE Clause with Missing Values (Corrected Output)
Overview of Summarizing Data
You can use an aggregate function (or summary function) to produce a statistical
summary of data in a table. The aggregate function instructs PROC SQL in how to
combine data in one or more columns. If you specify one column as the argument to an
aggregate function, then the values in that column are calculated. If you specify multiple
arguments, then the arguments or columns that are listed are calculated.
Note: When more than one argument is used within an SQL aggregate function, the
function is no longer considered to be an SQL aggregate or summary function. If
there is a like-named Base SAS function, then PROC SQL executes the Base SAS
function and the results that are returned are based on the values for the current row.
If no like-named Base SAS function exists, then an error will occur. For example, if
you use multiple arguments for the AVG function, an error will occur because there
is no AVG function for Base SAS.
When you use an aggregate function, PROC SQL applies the function to the entire table,
unless you use a GROUP BY clause. You can use aggregate functions in the SELECT or
Note: See “Grouping Data” on page 64 for information about producing summaries of
individual groups of data within a table.
Using Aggregate Functions
The following table lists the aggregate functions that you can use:
Table 2.6 Aggregate Functions
AVG, MEAN mean or average of values
COUNT, FREQ, N number of nonmissing values
56 Chapter 2 • Retrieving Data from a Single Table