Edit

SAS: PROC SQL (Order By)

2016/12/18
  This article shows sample program of 'Order By' clause being equivalent with 'Proc Sort & By statement'. One difference between 'Order By' and 'Proc Sort' is the option of descending.  The 'Order By' clause should write 'DESC' in the clause and should NOT use 'Descending.'


PROGRAM 
--------------------------------------

**************************************************
SORT: ORDER BY CLAUSE
TWO OPTIONS OF ASCENDING(ASC) AND DECENDING(DESC)
**************************************************;
PROC SQL ;
 CREATE TABLE DEMOG1 AS  
 SELECT *
 FROM DEMOG
 ORDER BY DOSE DESC, SEX    
 /*NOT USE 'DESCENDING.' THIS IS DIFFERENT FROM 'PROC SORT'*/
;
QUIT ;
PROC PRINT DATA=DEMOG1;
RUN ;
--------------------------------------  


OUTPUT




 

Search This Blog