BookmarkSubscribeRSS Feed
lalohg
Quartz | Level 8

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

11 REPLIES 11
Shmuel
Garnet | Level 18

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));

lalohg
Quartz | Level 8

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

 

ballardw
Super User

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.

lalohg
Quartz | Level 8

Shmuel
Garnet | Level 18

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. 

Reeza
Super User

Search ODSTITLE

 

ODSTITLE=title; 

ballardw
Super User

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.

lalohg
Quartz | Level 8

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

Reeza
Super User

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

lalohg
Quartz | Level 8
sorry, how can I look at that?

##- Please type your reply above this line. Simple formatting, no
attachments. -##

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
  • 11 replies
  • 2539 views
  • 0 likes
  • 4 in conversation