BookmarkSubscribeRSS Feed

[SAS 프로그래밍 고수 백승민] [MAX] 변수중에 2번째 큰값 찾기

Started ‎06-11-2020 by
Modified ‎06-11-2020 by
Views 81

* 출처 : http://cafe.daum.net/statsas/3F8j/163

 

 

1. PROC SQL (최홍규님)

   * 출처 : http://cafe.daum.net/statsas/B3m/12944

proc sql;
select max(변수)
from 데이터셋
where 변수 < (select max(변수) from 데이터셋)
;
quit;

 

2. PROC SQL의 MONOTONIC 함수

 

data back;
input x;
cards;
3
7
6
8
4
11
5
10
9
;
proc sql;
create table back1(where=(monotonic()=2)) as
select a.*
from back a
order by x desc;
quit;

Version history
Last update:
‎06-11-2020 04:32 AM
Updated by:
Contributors

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Article Labels
Article Tags