Programming the statistical procedures from SAS

Survival analysis w/ data structure of each row being separate measurement over time...

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

Survival analysis w/ data structure of each row being separate measurement over time...

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.


Accepted Solutions
Solution
‎05-23-2016 11:57 AM
Respected Advisor
Posts: 4,606

Re: Survival analysis w/ data structure of each row being separate measurement over time...

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


All Replies
Solution
‎05-23-2016 11:57 AM
Respected Advisor
Posts: 4,606

Re: Survival analysis w/ data structure of each row being separate measurement over time...

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
Occasional Contributor
Posts: 9

Re: Survival analysis w/ data structure of each row being separate measurement over time...

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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