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 is SAS OPTIMIZATION?

1817


What is the sas data set? : sas-grid-administration

576


what is factor analysis? : Sas-administrator

617


how to do user inputs and command line arguments in sas?

2430


how to change the execute of macro

1678






Explain what is data step?

731


what is program data vector? : Sas-administrator

617


What does proc print, and proc contents are used for?

613


In ARRAY processing, what does the DIM function do?

713


What do the PUT and INPUT functions do?

783


what are sas bi dashboard components? : Sas-bi

665


Describe what are the different levels of administrative users in sas? : sas-grid-administration

606


How will you use the WHO Drug Dictionary for Reporting Clinical Trials?

1886


What are the different versions of sas that you have used until now? : sas-grid-administration

735


what are the best practices to process the large data sets in sas programming? : Sas-administrator

544