backnextLearning Path
   

Additional Features

To further refine a PROC SQL query that contains a GROUP BY clause, you can use a HAVING clause. A HAVING clause works with the GROUP BY clause to restrict the groups that are displayed in the output, based on one or more specified conditions.

For example, the following PROC SQL query groups the output rows by JobCode. The HAVING clause uses the summary function AVG to specify that only the groups that have an average salary that is greater than 40,000 will be displayed in the output.

     proc sql;
        select jobcode,avg(salary) as Avg
           from sasuser.payrollmaster
           group by jobcode
           having avg(salary)>40000
           order by jobcode;
Note You can learn more about the use of the HAVING clause in the lesson .


  Copyright © 2003 SAS Institute Inc., Cary, NC, USA. All rights reserved.
Terms of Use & Legal Information | Privacy Statement
backnext