Programming the statistical procedures from SAS

Survival curve for repeated events using Proc Lifetest

Reply
Contributor
Posts: 24

Survival curve for repeated events using Proc Lifetest

I'm looking at customer purchase data for 3 years & I want to see their survival curves where the event is purchase & is repeatable.

The data looks like following:

data test;

     input id year status;

datalines;

1 1 1

1 2 1

1 3 1

2 1 1

2 3 0

3 2 1

3 3 0

4 3 1

5 1 1

5 3 1

6 2 1

6 3 1

7 1 1

7 2 1

7 3 0

;

There are 7 customers that were studied. Status =0 means that the observation is censored. So if someone bought in year 1 or/and year 2 but didn't buy in year 3 then the status is set to 0.

Following code is run:

ods graphics on;

proc lifetest data=test method=km plots=s(cl);

     time year*status(0);

     id id;

run;

ods graphics off;

                                                                    Survival

                                                                   Standard    Number    Number

                            year     Survival    Failure      Error         Failed       Left           id

                         0.00000       1.0000      0           0       0        15             .

                         1.00000            .           .           .       1        14             1

                         1.00000            .           .           .       2        13             2

                         1.00000            .           .           .       3        12             5

                         1.00000       0.73      0.26      0.11      4        11             7

                         2.00000            .           .           .       5        10             1

                         2.00000            .           .           .       6         9             3

                         2.00000            .           .           .       7         8             6

                         2.00000       0.46      0.53      0.128     8         7             7

                         3.00000            .           .           .       9         6             1

                         3.00000            .           .           .      10         5             4

                         3.00000            .           .           .      11         4             5

                         3.00000       0.20      0.80      0.10     12         3             6

                         3.00000*           .           .           .      12         2             2

                         3.00000*           .           .           .      12         1             3

                         3.00000*      0.20           .           .      12         0             7

I want it to count it the total number of cases to be 7 & not 15 because in a given year only 7 people are at risk of the event & not 15. It's just that these are repeated events & hence we've 15 observations. I want the probablity of failure in year 1 to be 4/7 & not 4/15 as in this case. How can I do this task?

Ask a Question
Discussion stats
  • 0 replies
  • 156 views
  • 0 likes
  • 1 in conversation