BookmarkSubscribeRSS Feed

[SAS 활용 FAQ] PROCEDURE - SORT

Started ‎11-01-2021 by
Modified ‎11-01-2021 by
Views 1,311
  • 하나 또는 그 이상의 변수의 오름차순(기본) 또는 내림차순으로 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;

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Article Labels
Article Tags