Having is used to filter grouped/aggregated numbers. In your example, amount_spend was not aggregated, so it will cause an error. proc sql; create table filtered As select name,sum(amount_spend) as Spent from have group by name having sum(Amount_Spend)> =10; quit; This code will have John->18 and Peter->130. However: proc sql; create table filtered As select name,sum(amount_spend) as Spent from have where amount_spend>=10 group by name having sum(Amount_Spend)> =10; quit; will give you John->15 and Peter->130. John's amount_spend = 3 was filtered out by the where clause.
... View more