我正在嘗試瀏覽日期列表,並且僅保留5次或更多次出現的日期的日期範圍,並刪除所有其他日期範圍。我的例子是:SAS:首先使用。最後。處理日期範圍
data test;
input dt dt2;
format dt dt2 date9.;
datalines;
20000 20001
20000 20002
20000 20003
21000 21001
21000 21002
21000 21003
21000 21004
21000 21005
;
run;
proc sort data = test;
by dt dt2;
run;
data check;
set test;
by dt dt2;
format dt dt2 date9.;
if last.dt = first.dt then
if abs(last.dt2 - first.dt) < 5 then delete;
run;
我想回到僅僅是一個入口,如果可能的話,但我會很樂意與整個適當的範圍內爲好。 的一個條目將是有一個表:
start_dt end_dt
21000 21005
合適的範圍是:
21000 21001
21000 21002
21000 21003
21000 21004
21000 21005
根據需要我的代碼不能正常工作,我不知道什麼樣的變化,我需要做。