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

Hi everyone,

 

I have been working on a template based off of a simular concept fo Sanjay's KM curves with At risk values being outside of the graph as seen here:

http://blogs.sas.com/content/graphicallyspeaking/2014/02/09/survival-plot/

(Specifically the SAS 9.3 Survival Plot with AtRisk Values outside the plot, specifically this version: http://blogs.sas.com/content/graphicallyspeaking/files/2014/02/SurvivalPlotAtRisk_Outside_Scatter_93... )

 

My problem is that if you have an extremely long group label, it pushes the y-axis label even further to the left.

Is there a way to change this and push the label closer to the graph?

I figured an extreme worst case situation would be to have the label be blank and then use drawtext to have it show up as a mock label? I have googled around on this topic and read some papers but didn't have much luck with any examples of using drawtext (or anything like that) to rotate and replicate a label.

 

ADDITIONALLY: In this example, if you have an extremely large count in your at risk set (like 10000 subjects at time 0) the x-axis and 0 has a large gap at the beginning. Is there any way to force the 0 to be closer to the where the x-axis/y-axis combine?

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

Yes, you are on the right track.  That is exactly what I did in this example.  I am using SAS 9.4 with AxisTable.  This example is from my upcoming book on Clinical Graphs.  But, you can get a sneak preview. Smiley Happy  Turn off the Y axis label, and use this code.

 

/*--Draw the Y axis label closer to the axis--*/
drawtext textattrs=(size=8) 'Survival Probability' / x=-6 y=50 anchor=bottom
xspace=wallpercent yspace=wallpercent rotate=90 width=50;


8_7_1_Survival_plot_out_V94.png

View solution in original post

7 REPLIES 7
Jay54
Meteorite | Level 14

Yes, you are on the right track.  That is exactly what I did in this example.  I am using SAS 9.4 with AxisTable.  This example is from my upcoming book on Clinical Graphs.  But, you can get a sneak preview. Smiley Happy  Turn off the Y axis label, and use this code.

 

/*--Draw the Y axis label closer to the axis--*/
drawtext textattrs=(size=8) 'Survival Probability' / x=-6 y=50 anchor=bottom
xspace=wallpercent yspace=wallpercent rotate=90 width=50;


8_7_1_Survival_plot_out_V94.png
egoodrich
Fluorite | Level 6

Thank you so much for your help Sanjay! The drawtext you provided really helped out. I will have to check out your new book when you have finished also.

 

I looked at your 9.4 example with AxisTable also, but it looks like that gap between the axis is still existing, but it's now disconnected. Is there no other way to push that gap in a little? (I've included an image of mine and how it's pushed further due to a large count).

 

Thanks,
Erica


gap_example.png
DanH_sas
SAS Super FREQ

You can use OFFSETMIN and OFFSETMAX to control the gaps at the "min" and the "max" of the axis.

Jay54
Meteorite | Level 14

That gap is created to correctly align the first Risk Table value (13619) with the "0" value on the x axis.  You may have longer values further below, but is is not visible.  You could try using OFFSETMIN=0 on the X axis, but that may chop off some values.

Jay54
Meteorite | Level 14

This is one reason I like to place the risk table inside the graph.  Proximity makes such things easier to see.

 


8_7_2_Survival_plot_in_V94.png
egoodrich
Fluorite | Level 6

Thanks Dan and Sanjay. I tried offsetmin in the x-axis prior to asking and didn't have any luck. It's a tricky situation because I do realize that it's that way because it lines up with the 0 tickmark. The research group I'm in have very strong preferences for the at risk values being outside of the graph, so while this is not a problem in the other method, I can't use it.

 

Thanks again for the help, I think it might be as good as I can get it without a smaller text font.

egoodrich
Fluorite | Level 6

Actually, I put an offsetmin ALSO in the xaxisoptions for the risk set (I don't know why I didn't think of that earlier...) 

but it does now seem to push it over! Thanks again!!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 7 replies
  • 1928 views
  • 3 likes
  • 3 in conversation