BookmarkSubscribeRSS Feed
shairstin
Calcite | Level 5

Hello 

I have a very simple question, but have not been able to solve it.

 

I am interested in the hazard function for my survival data, where patients are censored if they have not had the event of interest (death). Status 0=alive, 1= dead

 

ods graphics on;

proc lifetest data=mydata plots=hazard;

time survivaltime*status(0);

run;

ods graphics off;

 

I want to change the y and x-axis parameters on the hazard function plot (I need to re-label and change the tick marks).

 

Does someone have some easy code for this? Or a resource that is easy to follow? 

2 REPLIES 2
ballardw
Super User

@shairstin wrote:

Hello 

I have a very simple question, but have not been able to solve it.

 

I am interested in the hazard function for my survival data, where patients are censored if they have not had the event of interest (death). Status 0=alive, 1= dead

 

ods graphics on;

proc lifetest data=mydata plots=hazard;

time survivaltime*status(0);

run;

ods graphics off;

 

I want to change the y and x-axis parameters on the hazard function plot (I need to re-label and change the tick marks).

 

Does someone have some easy code for this? Or a resource that is easy to follow? 


 

When it comes to controlling graph appearance I tend to prefer having a data set and sending it to graphing procedure that lets me do what I want. Of course then option of modifying the data comes up as well.

 

You can get a data set used for the graph by adding an ODS OUTPUT statement:

ods graphics on;
ods output hazardplot=work.hazard;

proc lifetest data=mydata plots=hazard;
   time survivaltime*status(0);
run;

ods graphics off;

You can find the names of the created ODS objects, such as HAZARDPLOT in the details section of each procedure under the ODS Graphics (or ODS TABLES for tabular data).

 

StatDave
SAS Super FREQ

See this note and the examples that make various plot changes using the second method which saves the plot data and then uses PROC SGPLOT to redraw the plot as desired. The example on modifying the EFFECTPLOT shows how axis range and labels can be specified.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 886 views
  • 0 likes
  • 3 in conversation