I am currently using Stata 18.0 and have a minor issue which I however seem not to be able to resolve. I am using the sts graph command to create Kaplan-Meier curves before. In order to put the legend in the plot I was asked to use e different command. However, using that, the legend in the plot appears with the right labels however the labels of the number at risk below the plot cannot be changed using the graph editor and I do not manage to have the same labels as in the plot. Isch event label appears as ‘event = specific label’. Its only a problem when I want to put the legend in the plot and have to use the “risktable legend” option:
The old command I used:
The new command Im using:
I attach the two graphs.
Is there a way to use the risktable legend option but still be able to have the labels of the events of the risk table as a specific label and not as ‘event=xyz’?
Thank you very much for any help!
The old command I used:
Code:
tempfile t1 t2 stset TimetoRecurrence_5y, failure(IS_FU_Recurrence) gen event =1 save d1, replace stset, clear stset TimetoRecurrence_5y, failure(recurrent_cSAH_Recurrence) replace event = 2 save d2, replace stset , clear stset TimetoRecurrence_5y, failure(ICH_FU_Recurrence) replace event = 3 save d3, replace append using d1 append using d2 keep event _* sts graph , by(event) ylabel(0.5 (.25)1) risktable(, order(1 "Ischemic stroke" 2 "cSAH" 3 "ICH")) ysc(reverse)
Code:
tempfile t1 t2 stset TimetoRecurrence_5y, failure(IS_FU_Recurrence) gen event =1 save d1, replace stset, clear stset TimetoRecurrence_5y, failure(recurrent_cSAH_Recurrence) replace event = 2 save d2, replace stset , clear stset TimetoRecurrence_5y, failure(ICH_FU_Recurrence) replace event = 3 save d3, replace append using d1 append using d2 keep event _* label define eventlab 1 "Ischemic stroke" 2 "cSAH" 3 "ICH" label value event eventlab sts graph , by(event) ylabel(0.5 (.25)1) risktable legend( ring (0) pos (11) order(1 "Ischemic stroke" 2 "cSAH" 3 "ICH")) ysc(reverse)
Is there a way to use the risktable legend option but still be able to have the labels of the events of the risk table as a specific label and not as ‘event=xyz’?
Thank you very much for any help!
Comment