@Ksharp wrote: /*Assuming I understood what you mean.*/
data ONE ;
input id visit sbp ;
cards ;
101 10 95
101 20 .
101 30 90
102 10 100
102 20 105
102 30 .
103 10 90
103 20 90
103 30 115
104 10 .
104 20 100
104 30 .
104 40 105
;
data want;
do until(last.id);
set one;
by id;
if first.id then baseline=sbp;
max=max(max,sbp);
end;
do until(last.id);
set one;
by id;
if not missing(sbp) then locf=sbp;
bocf=coalesce(sbp,baseline);
wocf=coalesce(sbp,max);
output;
end;
drop max baseline;
run; Thankyou, it helped me in understanding my queries.
... View more