With the data on the survival for each group, is it possible to analyze on average how long each group lived? For example, with the data can we see if the high SES white group lived on average a certain number of years more in comparison to the low SES white group programmatically? I know I can see the difference here in the graph. Similarly with other group comparison
data test;
infile datalines dsd truncover;
input @1 subjid $7. @8 race_ses $20. @29 Years 5. @35 death 1.;
datalines;
6309 White, Medium SES 1.349 1
32678 Minority, Low SES 0.000 0
47274 White, Medium SES 0.501 0
66354 Minority, High SES 0 0
71686 White, High SES 0.002 1
97865 White, Medium SES 1.440 0
99032 Minority, Low SES 0.210 1
106165 Minority, Low SES 0.180 0
119509 White, High SES 0.254 0
120822 Minority, Low SES 2.212 0
128824 White, Medium SES 0 0
141997 White, Medium SES 0 1
154519 White, Medium SES 1.349 0
166227 White, High SES 0.057 0
180478 White, High SES 0 1
193038 White, Medium SES 0.002 0
200805 Minority, Medium SES 0.002 0
239179 White, High SES 0.254 0
248023 White, Medium SES 2.212 0
250211 Minority, Low SES 0 1
257887 Minority, Medium SES 0 0
280576 White, Medium SES 1.349 0
281024 Minority, Medium SES 0.057 0
288389 White, Medium SES 0 0
299579 White, High SES 0.002 0
304910 Minority, Medium SES 0.002 1
306267 White, High SES 2.537 0
308474 Minority, Medium SES 2.028 1
310910 White, High SES 0 0
;
run;
ods output survivalplot = output_data;
proc lifetest data = test method = km plots=s(test)
timelist = 0 1 2 5 10 15 20 25 30 conftype = linear;
time years * death(0);
strata race_ses;
run;
Thanks
Typically you'd look at the table with the title Quartile estimates and use the median survival (not average for survival as it's non parametric distribution and median is the standard usually reported.
In your data it appears as you don't have enough data or enough follow up to have median estimates. Or perhaps this is just a sample of your data and your actual data has enough?
FYI - this macro may be helpful for you.
https://gist.github.com/statgeek/d3bce2a9e2ef0523db9d
@RAVI2000 wrote:
With the data on the survival for each group, is it possible to analyze on average how long each group lived? For example, with the data can we see if the high SES white group lived on average a certain number of years more in comparison to the low SES white group programmatically? I know I can see the difference here in the graph. Similarly with other group comparison
data test; infile datalines dsd truncover; input @1 subjid $7. @8 race_ses $20. @29 Years 5. @35 death 1.; datalines; 6309 White, Medium SES 1.349 1 32678 Minority, Low SES 0.000 0 47274 White, Medium SES 0.501 0 66354 Minority, High SES 0 0 71686 White, High SES 0.002 1 97865 White, Medium SES 1.440 0 99032 Minority, Low SES 0.210 1 106165 Minority, Low SES 0.180 0 119509 White, High SES 0.254 0 120822 Minority, Low SES 2.212 0 128824 White, Medium SES 0 0 141997 White, Medium SES 0 1 154519 White, Medium SES 1.349 0 166227 White, High SES 0.057 0 180478 White, High SES 0 1 193038 White, Medium SES 0.002 0 200805 Minority, Medium SES 0.002 0 239179 White, High SES 0.254 0 248023 White, Medium SES 2.212 0 250211 Minority, Low SES 0 1 257887 Minority, Medium SES 0 0 280576 White, Medium SES 1.349 0 281024 Minority, Medium SES 0.057 0 288389 White, Medium SES 0 0 299579 White, High SES 0.002 0 304910 Minority, Medium SES 0.002 1 306267 White, High SES 2.537 0 308474 Minority, Medium SES 2.028 1 310910 White, High SES 0 0 ; run; ods output survivalplot = output_data; proc lifetest data = test method = km plots=s(test) timelist = 0 1 2 5 10 15 20 25 30 conftype = linear; time years * death(0); strata race_ses; run;
Thanks
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.