본문 바로가기
SAS

[SAS] SAS를 이용해 중복된 데이터만 추출하는 방법

by SASBIGDATA김진휘 2013. 11. 13.

SAS를 이용해 중복된 데이터만 추출하는 방법을 알아봅시다.

 

 

 

 

스샷 한장으로 이해할 수 있기를... hahahahaha

 

프로그램 코딩

 

data hwi;
input j h;
cards;
1 1
1 2
2 1
3 3
2 4
2 8
4 4
7 8
;
run;

proc sort data=hwi; by j; run;

data b;
set hwi;
by j;
if first.j=1 then num=0;
num+1;
run;

proc sort data=b; by j; run;

proc means data=b noprint;
by j;
var num;
output out=c(drop=_type_ _freq_) sum=ss;
run;

proc sort data=c; by j; run;
proc sort data=hwi; by j; run;
data d(drop=ss);
merge hwi c;
by j;
if ss>1;
run;

www.sasbigdata.coom 김진휘

댓글