DATA Step, Macro, Functions and more

Kaplan Meier Graph title

Reply
Contributor
Posts: 33

Kaplan Meier Graph title

Hi there,

does anyone know how I can change the title of a Kaplan Meier graph in SAS?

 

I ran the followings code but got the default title and would like to change it.

 

proc template;
delete Stat.Lifetest.Graphics.ProductLimitSurvival;
run;
ods graphics on;
ods trace on;
proc lifetest data=test plots=survival(nocensor test atrisk(maxlen=13));
time SG_months;
strata surgery;
run;
ods trace off;

 

 

Thank you

Trusted Advisor
Posts: 1,586

Re: Kaplan Meier Graph title

I don't see a title line in your code.

 

You may try add a line:

 

ods graphics on;
ods trace on;

title '... any text for title ...';
proc lifetest data=test plots=survival(nocensor test atrisk(maxlen=13));

Contributor
Posts: 33

Re: Kaplan Meier Graph title

Thanks Shmuel,

I added the line you suggest but still get the default title: "Product-Limit Survival Estimates"  and not the title I added

 

Thanks

 

Super User
Posts: 11,343

Re: Kaplan Meier Graph title

If the graph is needed for a more formal report or you need additional control over appearance dump the graph data to a dataset and use one of the graphing procedures.

 

If @Shmuel's suggestion is not sufficient you would have to trace down the graph template used, create a modified version changing the Entrytitle information and then use that template by putting it into you template path.

Contributor
Posts: 33

Re: Kaplan Meier Graph title

Trusted Advisor
Posts: 1,586

Re: Kaplan Meier Graph title

I'm not expert of SAS Graph.

You may find interest in next link:  http://support.sas.com/rnd/app/ODSGraphics/#s1=3

 

or an example for using PROC TEMPLATE in:  http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_templt_sect0...

 

with hope you will find what you are looking for. 

Super User
Posts: 19,875

Re: Kaplan Meier Graph title

Search ODSTITLE

 

ODSTITLE=title; 

Super User
Posts: 11,343

Re: Kaplan Meier Graph title

Setting the search path uses the ODS PATH statement:

ods path work.mystore(update) sashelp.tmplmst(read);

would set a store in the work library as a place you can update with modified versions of a template. By placing WORK.MYSTORE first then it is searched for specified templates before the defaults in the SASHELP library.

 

You can either use Proc template to list out the contents of any template which could be the basis for the code you want or  use the template browser, right click in the Results window, select Templates, exapand SASHELP.TMPLMST STAT>LIFETEST>GRAPHICS.

Select the template you want, in this case I think you want ProductLimitSurvival. Note the program you run may select ProductLimitSurvivalPanel based on your data and options. You may need to modify both. If you click on file it should open in the template browser as text that you can copy and paste into the editor or do a File SaveAS to a SAS program file.

Edit the code for any of the ENTRYTITLE lines. Note that there are multiples that are used based on the options and data you provide.

The bits with " " are literal text. You could change "Survival Estimates" to any thing you want such as "Survival estimates 1999 for product xyz".

You will see a keyword METHOD that is passed by the procedure to the graph. If you don't want that automatic text you may have to create your own DYNAMIC variable or replace with preferred literal text. Again there are multiple ENTRYTITLE statements and you may need to modify every one. "Survival Estimates" appears at about line 76 and is the third entrytitle statement is see for that template in my install. Yours may vary depending on SAS version.

 

Run the code with the modified version. If you only have one UPDATEable path that is where the result should go.

Then run your procedure.

If you are going to want to use this frequently then you may want to place this into a permanent library and insure the ODS Path always points there.

 

Note that this template is basically SAS GTL code and could be used with data exported from the procedure as well using Proc SGRENDER.

Contributor
Posts: 33

Re: Kaplan Meier Graph title

Thanks everybody for all your answers to my question. It seems very complicated doing it in SAS.....

 

What I did was to save the graph from the SAS Output as *.png and open it using "Paint" where I was able to modify the title by erasing the original title and inserting the new title by using the text box option 

 

Thanks again

Super User
Posts: 19,875

Re: Kaplan Meier Graph title

Well, if you're going to do it manually, look at SAS ODS Graphics Editor.

Contributor
Posts: 33

Re: Kaplan Meier Graph title

sorry, how can I look at that?

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Super User
Posts: 19,875

Re: Kaplan Meier Graph title

If you have SAS Base for Windows:

http://www2.sas.com/proceedings/forum2008/235-2008.pdf

Ask a Question
Discussion stats
  • 11 replies
  • 576 views
  • 0 likes
  • 4 in conversation