BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Xiaoningdemao
Quartz | Level 8

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,

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

6 REPLIES 6
Xiaoningdemao
Quartz | Level 8

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;

Reeza
Super User

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

Xiaoningdemao
Quartz | Level 8
Dear Reeza,
Thank you!
I am reviewing a similar article now.
But is this the only way to do so?
Best wishes.
Reeza
Super User

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. 

Xiaoningdemao
Quartz | Level 8
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,
Reeza
Super User

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. 

sas-innovate-2024.png

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
  • 6 replies
  • 2558 views
  • 0 likes
  • 2 in conversation