DATA Step, Macro, Functions and more

set y limit in PROC PHREG plots

Accepted Solution Solved
Reply
Contributor
Posts: 73
Accepted Solution

set y limit in PROC PHREG plots

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,


Accepted Solutions
Solution
‎08-04-2016 06:04 PM
Super User
Posts: 17,963

Re: set y limit in PROC PHREG plots

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/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_odsgraph_se...

 

https://support.sas.com/resources/papers/proceedings13/427-2013.pdf

 

Video tutorial

http://www.sas.com/reg/web/corp/938227

View solution in original post


All Replies
Contributor
Posts: 73

Re: set y limit in PROC PHREG plots

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;

Solution
‎08-04-2016 06:04 PM
Super User
Posts: 17,963

Re: set y limit in PROC PHREG plots

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/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_odsgraph_se...

 

https://support.sas.com/resources/papers/proceedings13/427-2013.pdf

 

Video tutorial

http://www.sas.com/reg/web/corp/938227

Contributor
Posts: 73

Re: set y limit in PROC PHREG plots

Dear Reeza,
Thank you!
I am reviewing a similar article now.
But is this the only way to do so?
Best wishes.
Super User
Posts: 17,963

Re: set y limit in PROC PHREG plots

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. 

Contributor
Posts: 73

Re: set y limit in PROC PHREG plots

Dear Reeza,
It's just I didn't expect this to be so complicated..... I will try the template way first.
Thanks again!
Best wishes,
Super User
Posts: 17,963

Re: set y limit in PROC PHREG plots

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. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 294 views
  • 0 likes
  • 2 in conversation