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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 1518 views
  • 2 likes
  • 2 in conversation