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
What are the parameters of scan function?
What are the difficulties u faced while doing vital signs table or dataset?
Difference between informat and format?
Mention what is the difference between nodupkey and nodup options?
What are the ways in which macro variables can be created in sas programming?
What do the sas log messages “numeric values have been converted to character” mean? What are the implications?
what is the difference between: x=a+b+c+d; and x=sum (of a, b, c ,d);? : Sas programming
How to include or exclude specific variables in a data set?
If you use a symput in a data step, when and where can you use the macro variable? : sas-macro
What is the role of sas grid administrator? : sas-grid-administration
Differences between where and if statement?
What do the SAS log messages "numeric values have been converted to character" mean?
how are numeric and character missing values represented internally? : Sas programming
What is PDV?
Name any two sas spawners? : sas-grid-administration