You need to merge or join the original data with its observations that are baseline.
data adlb ;
do usubjid = "1" , "2" ;
do visitnum = 1 to 10 ;
aval = ranuni( 1 ) ;
if visitnum = 1 then ablfl = "Y" ;
else ablfl = " " ;
output ;
end ;
end ;
run ;
proc sql ;
create table adlb_base as
select a.*
, case when ablfl = " " then b.aval
else .
end as base
from adlb as a
left join ( select usubjid
, aval
from adlb
where ablfl = "Y"
) as b
on a.usubjid = b.usubjid
order by a.usubjid
, a.visitnum
;
quit ;
HTH,
Kevin
... View more