The double do until is ideal for this
data have;
input Name $ Value :??best.;
datalines;
A --
A 22
A --
A --
A 35
A --
A --
B --
B 3
B 7
B --
B --
B 90
B --
C --
;
data want;
do i=1 by 1 until(last.name);
set have; by name;
if not missing(value) then do;
if missing(first) then first = i;
last = i;
end;
end;
do i=1 by 1 until(last.name);
set have; by name;
if i >= first then
if i <= last then output;
end;
drop first last i;
run;
proc print; run;
... View more