Hi everyone,
I have the next dataset:
subjid cpevent text value
100 screening weight 40
100 day1 weight .
100 day1 pulse .
and I want to get:
100 day1 weight 40
100 day1 pulse .
I mean, recording only the previous value when baseline (day1) is missing, (weigth 40), but keeping the missing value of baseline
if not previous value are recording (pulse dont have screening record, then I leave blank ).
Cheers,
V
If I understand you correctly,
data have;
infile cards truncover;
input (subjid cpevent text) (:$10.) value;
cards;
100 screening weight 40
100 day1 weight .
100 day1 pulse .
;
data want (drop=_w);
set have;
retain _w;
by subjid;
if first.subjid and cpevent='screening' then _w=value;
if value=. and text='weight' then value=_w;
if cpevent ne 'screening' then output;
run;
proc print;run;
Regards,
Haikuo
Not understand what you mean.
data have; infile cards truncover; input (subjid cpevent text) (:$10.) value; cards; 100 screening weight 40 100 day1 weight . 100 day1 pulse . ; run; data want(where=(cpevent='day1')); set have; lag_value=lag(value); if subjid eq lag(subjid) and cpevent='day1' and missing(value) then value=lag_value; drop lag_value; run;
Ksharp
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: