BookmarkSubscribeRSS Feed
T
Calcite | Level 5 T
Calcite | Level 5

Hi,

It seems that when I'm using PROC LIFETEST to create a survival plot with number-at-risk printed on the x-axis, that whenever at least one stratum label is more than 3 characters the number-at-risk labels are printed as 1, 2, etc instead of the full strata format labels, while the strata names are printed as "1: [Label stratum 1]", "2: [Label Stratum 2]", etc. in legends (with the corresponding labels of each stratum instead of the bracketed text). See the attached file for an example (created using non-sensical data).

I've been trying to get around this by modifying the template used to create the plots (Stat.Lifetest.Graphics.ProductLimitSurvival) to force the procedure to always print the full label (some additional tweaking will of course be necessary for long format labels), but I can't seem to get very much further at the moment. From what I can tell, the names to print in the figure are actually created before the template is called, since the parts of the plotting statements which hold the labels in question are never declared in the template. These include STRATUM (seems to hold stratum labels), and CLASSATRISK (seems to hold the number-at-risk labels).

Is there any way to figure out where these undeclared variables come from? If not, is there any simpler way to do what I want?


SurvivalPlot31.png
3 REPLIES 3
Reeza
Super User

In the blockplot statement  unde the if (PLOTATRISK) change the class=CLASSATRISK to class=STRATUM

It still has the number but the name is there as well and remember to change both of them (under first IF and second IF).

If you want just the name then you might want to use sgplot on the output dataset instead, search lexjansen.com for a paper and pharmasug in 2011 by Sanjay from SAS.

T
Calcite | Level 5 T
Calcite | Level 5

I see. It was helpful to actually have a look at the data that is passed to the plotting procedure. Like you point out, I see now that this won't allow me to add the original labels using a modified template, since the original labels are not to be found in there.

I suppose it's not possible then to modify or create new input data using statements within a template, not even temporary variables (I guess this is a bit of a newbie-question)?

Oh, well. I guess I'll have to write a macro for manual plotting using SGPLOT then. And I think this was the paper you were referring to.

http://support.sas.com/resources/papers/proceedings11/281-2011.pdf

Thanks for your reply!

Reeza
Super User

The original IDs are in the variable STRATUMID but I don't know how to add that into the template.  You can try replacing the graphdatavalue/graphdatatext with that in the template and see if it works. Replace the classatrisk with STRatum provides the labels as 1: YOURLABEL and 2: YOUR LABEL. The legend will also have that by default and for now I can't see a way around it. SAS support has an example of how to get the atrisk table at the bottom of the graph (rather than inside) you may want to check that one. It'll be fully customized for that particular procedure but will work.

Or contact tech support Smiley Happy.

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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