0

I have data that looks like this:

data

where month is the number of months that have passed, vegetable is a category of interests, and n_spoiled is the number of vegetables from that category that spoiled after x amount of months.

I am interested in running a survival analysis to compare the curves for these three categories (proc lifetest).

It is my understanding that in SAS to run a survival analysis we need the 'uncollapsed' version of this data such that for example we will see 3289 entries with month=1 and potato, 9 entries with month=1 and onion and so on. None of this entries would need to censored for the analysis as all non-completions were omitted form the aggregated data.

I would really appreciate if someone could help me modify the data so that it runs OR alternatively, instruct me as to how to run the test without 'uncollapsing' the data.

Thank you.

Tomikuz
  • 37
  • 6
  • 1
    Look at the FREQ statement, you can pipe N_SPOILED to the FREQ and use PHREG. LIFETEST has a similar option. https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/statug/statug_lifetest_syntax03.htm – Reeza Sep 22 '21 at 21:32
  • 1
    I don't see a censor variable, you'll need to add that though. – Reeza Sep 22 '21 at 21:33
  • 1
    You need to know the number of unspoiled vegetables of each kind that were at risk. To calculate risk you need number of events, times of events and numbers at risk at the time of events. These principles are not specific to SAS. They are fundamental to survival analysis. – IRTFM Sep 23 '21 at 06:56

0 Answers0