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 ?
    

Answers were Sorted based on User's Feedback



Can we use where and having clauses in a single SAS program. ex: proc sql;     select ..

Answer / 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

Can we use where and having clauses in a single SAS program. ex: proc sql;     select ..

Answer / rajasekaran

having statement should mentioned after group by statement only

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

Is This Answer Correct ?    3 Yes 1 No

Can we use where and having clauses in a single SAS program. ex: proc sql;     select ..

Answer / a.k.naidu

Having clause can be used only with 'group by'. Difference between 'where' and 'having' is that former works on variable level and latter works on observation level. 'having' works like second where condition on "grouped data"

Is This Answer Correct ?    2 Yes 0 No

Can we use where and having clauses in a single SAS program. ex: proc sql;     select ..

Answer / santhosh

worng

Is This Answer Correct ?    1 Yes 7 No

Post New Answer

More SAS Interview Questions

how are numeric and character missing values represented internally? : Sas programming

0 Answers  


What is the purpose of the trailing and How would you use them?

8 Answers  


Difference b/n proc means and proc summary procedures?

3 Answers   Accenture,


Do you use PROC REPORT or PROC TABULATE? Which do you prefer? Explain.

3 Answers  


What is the size of PDV?

2 Answers   L&T,






Explain the difference between informat and format with an example.

0 Answers  


what is slowly changing dimension? : Sas-di

0 Answers  


Tell different ways to create Macrovarible?

3 Answers   Accenture, PharmaNet i3,


What is SAS? What are the functions does it performs?

0 Answers  


Are you involved in writing the inferential analysis plan? Tables specfications?

0 Answers  


What is the purpose of using the N=PS option?

2 Answers   Oracle,


what is null hypothesis? why do you consider that?

0 Answers   Accenture, Quintiles,


Categories