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
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 |
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 |
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 |
how are numeric and character missing values represented internally? : Sas programming
What is the purpose of the trailing and How would you use them?
Difference b/n proc means and proc summary procedures?
Do you use PROC REPORT or PROC TABULATE? Which do you prefer? Explain.
What is the size of PDV?
Explain the difference between informat and format with an example.
what is slowly changing dimension? : Sas-di
Tell different ways to create Macrovarible?
3 Answers Accenture, PharmaNet i3,
What is SAS? What are the functions does it performs?
Are you involved in writing the inferential analysis plan? Tables specfications?
What is the purpose of using the N=PS option?
what is null hypothesis? why do you consider that?
0 Answers Accenture, Quintiles,