BookmarkSubscribeRSS Feed
LD4224
Calcite | Level 5

Hello - I'm using PHREG to estimate survival functions for 2 groups.  I have clustered observations (2 hips per person) so cannot use LIFETEST.  I've generated the plot but would like to add additional information, especially the confidence bands.  Options like NOCENSOR and ATRISK would be helpful, too.

 

This is my code:

PROC PHREG DATA=WORK.DDH2340            PLOTS(OVERLAY=ROW)=S            COVS(AGGREGATE);

MODEL NEWSURV_YR*CENSOR(1)=COHORT/ TIES=BRESLOW;

STRATA COHORT;

ID ID;

BASELINE OUT=A SURVIVAL=S LOWER=LCL UPPER=UCL;

run;

 

Ideas?

Thanks

 

1 REPLY 1
Rick_SAS
SAS Super FREQ

It sounds like you are trying to output the information to a SAS data set and then use PROC SGPLOT to create the graph. If so, you can use the BAND statement to create prediction intervals.

 

data Have;
do Group = 1, 2;
   do t = 0 to 10;
      Prob = exp(-Group*t/10);
      Lower = max(0, Prob - 0.05*Group);
      Upper = min(1, Prob + 0.05*Group);
      output;
   end;
end;
run;

proc sgplot data=Have;
band x=t lower=Lower upper=Upper / group=Group transparency=0.5;
series x=t y=Prob / group=Group;
run;

Regarding the counts (AtRsik, etc), you can use a XAXISTABLE statement to create a table of numbers inside the plot, See these examples:

https://blogs.sas.com/content/graphicallyspeaking/2018/02/19/survival-plot-twist-using-sgplot-proced...

https://blogs.sas.com/content/graphicallyspeaking/2014/02/09/survival-plot/https://blogs.sas.com/content/graphicallyspeaking/2016/07/17/graph-table-with-class/

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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