Hi All,
I want to know wheter there is a way to control the y limit in proc phreg plot? The censoring rate in my data set is high, so at the end of time, the survival probablity is still more than 0.6. so I want the plot to only show y from 0.6 to 1.
The option 'range' in proc phreg only control the x range not y range.
I also tried ods, but can't get it work.
I attached my code below, hope it can help
proc phreg data=modeldata plots(overlay CL)=(survival) ;
class sex ;
model followup*pass(0)= age sex ;
baseline covariates=baseline_sex out=data/rowid=sex;
run;
Thanks a lot!!
Best wish,
You're better off customizing the proc phreg template.
There are instructions on how to do so for PROC LIFETEST but the process is similar for PROC PHREG.
In general, run proc template once to get the source code. Copy it and find where it mentions Yaxis - there may be multiple locations. Modify the values in all locations.
And then restore the original template.
https://support.sas.com/resources/papers/proceedings13/427-2013.pdf
Video tutorial
I also creat a template but don't know how to use it...
proc template;
define statgraph layoutoverlay;
begingraph;
*entrytitle "Trends in Employment Levels";
layout overlay / yaxisopts=(linearopts=(viewmin=0.8 viewmax=1 ));
endlayout;
endgraph;
end;
run;
You're better off customizing the proc phreg template.
There are instructions on how to do so for PROC LIFETEST but the process is similar for PROC PHREG.
In general, run proc template once to get the source code. Copy it and find where it mentions Yaxis - there may be multiple locations. Modify the values in all locations.
And then restore the original template.
https://support.sas.com/resources/papers/proceedings13/427-2013.pdf
Video tutorial
The other way is to extract the raw data and create your own code from 'scratch' using SGPLOT. I'm not familiar with an option within PROC PHREG that allows you customize the plots.
There are many samples of code online if you choose to create your own graph from scratch.
Templates are pretty straightforward.
It's one of those things where you can get 90% of what you want but that last 10% is gong to take the longest. Pretty common when using pre canned routines in any system.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.