BookmarkSubscribeRSS Feed
Naveen1111
Calcite | Level 5

Hi All,

 

Could someone tell me how can I further deduplicate it (as per my knowledge full join combines the result of both left and right outer join) Also, please help me with the sequence/order of SQL syntax as I tried to execute the below program, but it didn't work . Need to know where should I terminate each statement and in which order, should I use order by syntax first or group by or where condition?

 

proc sql; create table ph as select* from sashelp.class where age>14 order by weight desc group by sex; quit;

3 REPLIES 3
Jagadishkatam
Amethyst | Level 16

The below paper should help you with all details

https://support.sas.com/resources/papers/proceedings/proceedings/sugi29/268-29.pdf 

Thanks,
Jag
PGStats
Opal | Level 21

The clauses of a simple SQL query should be ordered like this:

 

proc sql;
create table ph as 
select * 
from sashelp.class 
where age > 14 
group by sex
having weight > mean(weight)
order by weight desc;
quit;
PG

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 599 views
  • 0 likes
  • 4 in conversation