BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mhtoto
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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;
PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

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;
PG
mhtoto
Fluorite | Level 6

Thanks PG for your timely response.  Exactly what I needed.  Worked perfectly.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 2 replies
  • 1700 views
  • 2 likes
  • 2 in conversation