Basically I need a way to find the first entry in the Censoring_Event column (based on MINIMUM time), and then delete any other subsequent entries.
Patient Censoring_Event Time
1 1
1 3
1 4
1 0 7
(this pt does not pose a problem as the first 3 entries will just be ignored when using proc lifetest)
2 1
2 6
2 1 8
2 9
2 0 14
(even if the pt had the event a 0 shows up at their last f/u date)
3 1
3 2
3 5
3 1 11
3 1 19
(some pts experience the censoring even more than once)
Any help would be appreciated.
One simple way to do this:
data have;
input Patient Censoring_Event Time;
datalines;
1 . 1
1 . 3
1 . 4
1 0 7
2 . 1
2 . 6
2 1 8
2 . 9
2 0 14
3 . 1
3 . 2
3 . 5
3 1 11
3 1 19
;
data want;
do until(last.patient);
set have; by Patient;
if not drop then output;
if not missing(censoring_event) then drop = 1;
end;
drop drop;
run;
proc print noobs; run;
One simple way to do this:
data have;
input Patient Censoring_Event Time;
datalines;
1 . 1
1 . 3
1 . 4
1 0 7
2 . 1
2 . 6
2 1 8
2 . 9
2 0 14
3 . 1
3 . 2
3 . 5
3 1 11
3 1 19
;
data want;
do until(last.patient);
set have; by Patient;
if not drop then output;
if not missing(censoring_event) then drop = 1;
end;
drop drop;
run;
proc print noobs; run;
Thanks PG for your timely response. Exactly what I needed. Worked perfectly.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.