|
Re: 请教:利用nodupkey可以去重复数据,但有没有简单办法把重复数据挑出来
Good idea! This could be a little more concise:
proc sql;
create table one_a as
select *, monotonic() as id
from abs
order by ksdm,rq;
create table two_a as
select *
from one_a
group by ksdm,rq
having max(id) ne min(id);
alter table two_a drop id;
quit;
[quote="MerlinZHOU":2pm7kenj][code:2pm7kenj]
data abs;
input blh $12. ksdm : $ 15. rq yymmdd10.;
cards;
PID000529036 8楼儿童病区 2012-3-13
PID000529036 ICU 2012-3-13
PID000529036 ICU 2012-3-14
PID000529036 ICU 2012-3-15
PID000529036 6楼儿童病区2 2012-3-13
PID000531543 8楼儿童病区 2012-3-14
PID000531543 ICU 2012-3-15
PID000531543 ICU 2012-3-16
;
proc sql;
create table one as
select *
from abs
order by
ksdm,rq;
create table two as
select *, monotonic() as id
from one;
create table three as
select *
from two
group by ksdm,rq
having max(id)^=min(id);
alter table three drop id;
quit;
[/code:2pm7kenj][/quote:2pm7kenj] |
|