There was no output.
I used the following:
proc lifetest data=sample plots=survival(f)
outsurv=survival_data timelist=(0 to 200 by 12) reduceout;
strata group;
time time2event*censor(1);
run;
I get the dataset to be use in proc sgplot but I am not sure what to put in the Y axis. The examples I've seen are with "Survival" not like the graph for cumulative incidence. I tried to use Failure but it says that the variable does not exist.
with this code:
proc sgplot data=survival_data;
step x=time2event y=survival/group=stratum name="Percentage of patients reporting the first event";
xaxis values=(0 to 24 by 2) valueshint label="Time to event (Months)";
yaxis offsetmin=0.02 min=0 offsetmax=0.1 max=1.0 label="Percentage of patients reporting the First Event";
run;
I get this output:
Yes, you are right, the failure plot is what we need. I used ODS TRACE ON as you advised and got the right name:
ods trace on;
ods output failureplot=sp;
proc lifetest data=sample plots=survival(f)
outsurv=survival_data timelist=(0 to 24 by 2) reduceout;
strata group;
time time2event*censor(1);
run;
proc sgplot data=sp;
step x=time y=_1_survival_/group=stratum name="Percentage of patients reporting the first event";
xaxis values=(0 to 24 by 2) valueshint label="Time to event (Months)";
yaxis offsetmin=0.02 min=0 offsetmax=0.1 max=1.0 label="Percentage of patients reporting the First Event";
run;
and got this:
Looks ok right? I used variable _1_survival_ instead of survival. I have a question if we want to show the censored, how will you add it?
Thanks for sharing. What is the difference between these two statements?:
scatter x=time y=censored / markerattrs=(symbol=plus) name='c';
scatter x=time y=censored / markerattrs=(symbol=plus) GROUP=stratum;
And since this is a failure plot, should I use _1_censored_ instead of censored?
proc sgplot data=sp;
step x=time y=_1_survival_/group=stratum name="Percentage of patients reporting the first event";
xaxis values=(0 to 24 by 2) valueshint label="Time to event (Months)";
yaxis offsetmin=0.02 min=0 offsetmax=0.1 max=1.0 label="Percentage of patients reporting the First Event";
scatter x=time y=_1_censored_ / markerattrs=(symbol=plus) name='censored';
scatter x=time y=_1_censored_ / markerattrs=(symbol=plus) GROUP=stratum;
run;
This is the figure.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.