The HAVING Clause
A Brief Overview
The HAVING clause tells
PROC SQL how to filter the data after summarization. You can use a
HAVING clause with a GROUP BY clause to filter grouped data. The HAVING
clause affects groups in a way that is similar to how a WHERE clause
affects individual rows. When you use a HAVING clause, PROC SQL displays
only the groups that satisfy the HAVING expression.
Note: You can use summary functions
in a HAVING clause but not in a WHERE clause. The HAVING clause is
used with groups, but a WHERE clause can be used only with individual
rows.
HAVING Clause Syntax
Syntax, HAVING clause:
PROC SQL <options>;
SELECT column-1 <,...column-n> FROM input-tables
WHERE expression
GROUP
BY column-name <,column-name> |
Get SAS Certified Professional Prep Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.