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

Explain by-group processing?

0 Answers  


hi all, I need the SAS DI DUMP(A00 260) for attending the certification. if any one have, pls provide it.Please Email to vrpotluri@hotmail.com. Thanks - Ramana

0 Answers   SAS,


what are all the default values getting in PROC MEANS...???

2 Answers  


Tell me about % include and % eval? : sas-macro

0 Answers  


what are the considerations when picking a SAS/STAT procedure?

0 Answers   Accenture, Quintiles,






hi i am nipun can anybody tell me that if a clinical sas programmer write the code and after successfull execution where do they store it. how they submit tables to TL how work is assigned to programmers either both code, log, output to be submitted. can any one tell me the process

2 Answers   HSBC,


If you?re not wanting any SAS output from a data step, how would you code the data statement to prevent SAS from producing a set?

1 Answers  


If you need the value of a variable rather than the variable itself what would you use to load the value to a macro variable?

2 Answers  


how to add distinctly var variable values ex.. Data a; input var; datalines; 0 1 2 3 -1 -2 -3 ; run; adding all +ve value in one varibale n do the same for -ve too

5 Answers   CTS,


What do you understand by the term Normal Distribution?

0 Answers  


Name the option to produce a frequency line items rather that a table.

2 Answers  


what r the job openings SAS for fresher graduates !

0 Answers   TetraSoft, Wipro,


Categories