BookmarkSubscribeRSS Feed

[SAS 활용 FAQ] PROCEDURE - SORT

Started ‎11-01-2021 by
Modified ‎11-01-2021 by
Views 978
  • 하나 또는 그 이상의 변수의 오름차순(기본) 또는 내림차순으로 SAS data set을 정렬.
  • 원래 data set을 갱신하거나 새로운 data set을 생성할 수 있음.

 

PROC SORT DATA = input-SAS-data-set

< OUT = output-SAS-data-set >;

BY <DESCENDING> by-variable(s);

RUN;

 

 

◀예제▶ sashelp.class를 age 오름차순으로 먼저 정렬하고, Age가 같은 그룹 내에서는 name 내림차순으로 정렬. 결과를 work.class 로 생성.

 

PROC SORT DATA=sashelp.class OUT=class;

BY age descending name;

RUN;

Version history
Last update:
‎11-01-2021 11:10 PM
Updated by:
Contributors

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Article Labels
Article Tags