新手用九牛二虎之力才写出来的。供你见笑!
proc sql;
create table d2 as
select *,min(date) as date1 format=yymmdd10.
from d1
where fuxie=1
group by school
order by date
;
quit;
proc sql;
create table d3 as
select *,count(name) as count
from d2
group by school,name
;
quit;
data d4;
set d3;
by school;
day=intck("day",date1,date)+1;
run;
proc sql;
create table d5 as
select distinct school,name,fuxie,date,count
from d4
where day lt 7
union
select school,name,fuxie,date,count
from d4
where day >7
;
quit;
data d6;
set d5;
by school;
if first.school then fuxiecishu=1;
else fuxiecishu+1;
run;
data d7;
set d6;
where fuxiecishu>=3 ;
keep school fuxiecishu date;
run;
|