BookmarkSubscribeRSS Feed
Fluorite | Level 6

Hi guys! I'm new to proc sgplot function and have some questions:

here is the plot I want to make:

Screenshot 2024-01-03 at 5.51.59 PM.png

here is what I get :

Screenshot 2024-01-03 at 5.57.27 PM.png


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.;

/*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;

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!

Screenshot 2024-01-03 at 6.00.45 PM.png

Super User

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.


Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.


Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1 like
  • 2 in conversation