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/

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1327 views
  • 1 like
  • 2 in conversation