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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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