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

How many ways to overcome a missing values???

2323


What are symget and symput? : sas-macro

718


What is the good sas programming practices for processing large data sets?

621


How would you define the end of a macro?

690


how does sas handle missing values in formats? : Sas programming

570






How long can a macro variable be? A token? : sas-macro

707


What is a macro routine?

2091


Enlist the functions performed by sas.

666


How you are maintaining sas programmes in your company...any specific version control software you are using? If so, tell me the name?

1569


If you could design your ideal job, what would it look like?

2361


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

631


What is a put statement?

656


Describe crosslist option in tables statement?

699


name some data transformation used in sas di? : Sas-di

535


For clinical entire study how many tables will create approx?

1512