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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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