Hi guys! I'm new to proc sgplot function and have some questions:
here is the plot I want to make:
here is what I get :
my code:
ods output Survivalplot=SurvivalPlotData; /*将生存分析图的数据输入到SurvivalPlotData中*/; ods graphics on; proc lifetest data=adtte2 plots=survival(atrisk=0 to 15 by 3 outside(0.15)); time aval*cnsr(1); strata trtp/order=internal test=logrank adjust=sidak; /**按trtp来分层分析,使用log-rank检验进行生存曲线比较**/ format trtp tfmt.; run; /*Using Proc Sgplot*/; ods listing style = htmlblue gpath="/home/u62957101/sasuser.v94/Project2C/output"; ods graphics / reset width=6in height=4in imagename="Survival_Plot_SG" ; title1 j=c "Kaplan Meier Curves for Progression Free Survival by Treatment Arm in Second"; title2 j=c"Remission"; title3 j=c"Randomized Subjects with 2nd Remission"; footnote1 " "; footnote2 j=l h=6pt "Study PRJ5457C" j=r "Page 1 of 1"; footnote3 j=l h=6pt "TLG Specifications, Version 9.4";/**脚注左对齐,脚注垂直文本高度为6磅,且斜体**/; /*Creation of KM Plot*/; proc sgplot data=SurvivalPlotData noborder; step x=time y=survival / group=stratum name="s"; scatter x=time y=censored/ markerattrs=(symbol=plus ) GROUP=stratum; scatter x=time y=censored / markerattrs=(symbol=plus) name="c"; xaxis values=(0 to 15 by 3) label="Time to Progression(month)" ; yaxis label="Progression-Free Rate"; xaxistable atrisk/ x=tatrisk class=stratum colorgroup=stratum valueattrs=(weight=bold); /**x轴下方添加表格,显示每个时间点处于风险的数量;**/ keylegend "s" / linelength=20; keylegend "c" / location = inside position=topright; run;
My question is that : where can I find any file to learn how to put the value on the table? I've read some files you shared in the website , but can't still figure out how to deal with this part? Thank you!
Have you looked at the INSET statement in Proc SGPLOT? Add variables with the values you want to your plot data set and have the labels for those variables set to display the label text desired.
Then use those variables in the Inset statement.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.