Can we use where and having clauses in a single SAS program.

ex: proc sql;
    select a,b,c from test
     where state in 'KA'
     and having <some condition>.

Is the above program run correctly, if not why ?
    

Answer Posted / rauthu

Yes, WHERE and HAVING can be used in single program. HAVING must be after GROUP by clause.
Example:
proc sql;
select make, model, avg(msrp) as avgmsrp, msrp
from sashelp.cars
where make ='Honda'
group by model
having avgmsrp < 100000;
quit;

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do the put and input function do?

768


Explain the difference between using drop = data set option in set and data statement?

904


Difference between informat and format?

837


WHAT IS SAS WEB SERVICE and what are the steps to create an xml service ?

2518


What are SAS/ACCESS and SAS/CONNECT?

847


For a user to have access to a standard workspace server, is internal authentication alone is sufficient? : sas-grid-administration

720


what are several options for creating reports in web report studio? : Sas-bi

839


what is information maps?

1811


How do you define proc in sas? : sas-grid-administration

853


what is transformation in sas data integration? : Sas-di

750


What are the prime responsibilities of data integration administrator? : Sas-di

791


Explain the use of proc print and proc contents?

724


Explain substr function?

769


Describe the ways in which you can create macro variables?

828


what is hierarchy flattening? : Sas-di

818