是这个意思?
data a;
input subject times dose;
cards;
1011 1 3
1011 2 5
1011 3 3
1011 4 5
1011 5 5
1011 6 5
;
data b;
set a;
lagdos=lag(dose);
if subject ne lag(subject) then call missing(lagdos);
if dose=lagdos then delete;drop lagdos;
run;
proc sql;
create table wanted as
select * from b
group by subject
having times=max(times);
quit;
data b;
set a;
lagdos=lag(dose);
if subject ne lag(subject) then call missing(lagdos);
if dose=lagdos then delete;drop lagdos;
run;
proc sql;
create table wanted as
select * from b
group by subject
having times=max(times);
quit;