BookmarkSubscribeRSS Feed

[SAS 활용 FAQ] PROCEDURE - SORT

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Article Labels
Article Tags