i have a data s follows: there are only 2 variables, age group (age) and survival time (time). there is no censoring observations.
input age $ time ;
cards;
"<=40" 2
"<=40" 3
"<=40" 6
"<=40" 6
"<=40" 7
"<=40" 10
"<=40" 15
"<=40" 15
"<=40" 16
"<=40" 27
"<=40" 30
"<=40" 32
">40" 1
">40" 1
">40" 1
">40" 1
">40" 2
">40" 3
">40" 3
">40" 9
">40" 22
;
i have two questions:
1) did i enter the data correctly?
2) how do i conduct a log-rank test to compare survival curves between 2 age groups?
Hello @tinghlin,
@tinghlin wrote:
1) did i enter the data correctly?
You can work with the data as shown, but it is more common to store character values without enclosing quotation marks:
data have; input age $ time; cards; <=40 2 <=40 3 ...
2) how do i conduct a log-rank test to compare survival curves between 2 age groups?
This is typically done with PROC LIFETEST. In the absence of censored observations (as in your example) this step looks like this:
proc lifetest data=have;
time time;
strata age;
run;
where you would replace "have" with the name of your input dataset containing variables time and age.
You find the result under "Test of Equality over Strata" in the PROC LIFETEST output:
Test of Equality over Strata Pr > Test Chi-Square DF Chi-Square Log-Rank 6.1690 1 0.0130 Wilcoxon 7.8000 1 0.0052 -2Log(LR) 5.4753 1 0.0193
So the log-rank test detects a significant difference between the survival curves of the two age groups (assuming a significance level a=0.05).
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.