BookmarkSubscribeRSS Feed
marieK
Obsidian | Level 7
Hey,

i would like to rename the png-graphs from my proc lifetest (i have two different graphs: survival- and the Loglogs-graph). My output png-Graphs are named with 'LogNegLogSurvivalPlot.png' and 'SurvivalPlot.png'. i would like to add the variable name at the end so that i got 'LogNegLogSurvivalPlot_varname.png' and 'SurvivalPlot_varname.png'.

Is that possible?

thanks in advance. Marie
3 REPLIES 3
GraphGuy
Meteorite | Level 14
Although "proc lifetest" generates graphs, it isn't per-say a SAS/Graph proc, and they do things a little differently ... so I'm not too familiar with it.

But I do have 1 example, and it controls the name of the png files using "ods graphics" imagename= option, such as:

ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm" style=Theme;
ods graphics on / imagefmt=staticmap imagename="&name";

(Rather than using the &name macro variable, you could probably put in whatever name you want 🙂

Here's the full example, if you want to see it:

http://robslink.com/SAS/democd20/life.htm
http://robslink.com/SAS/democd20/life_info.htm
marieK
Obsidian | Level 7
Hi Robert,

thank you! i already found that imagename= option, but then both output graphs have these names (name.png and name1.png).
'LogNegLogSurvivalPlot.png' and 'SurvivalPlot.png' are automatically given names from SAS, i just want to add my variable name at the ending so that i dont loose the overview with 20 variables and still know if its the LogNegLogSurvival Plot or the Survival Plot 😉

So is the any chance to name them seperated?
DanH_sas
SAS Super FREQ
Hey Marie,

Robert's suggestion of using IMAGENAME could still work for you. Here are a few ways you could make it work:

1. Use the PLOTS option on PROC LIFETEST to select each plot and run the procedure twice, changing the name each time.
2. Do #1 above using ODS SELECT if PLOTS does not give you the control you need.
3. Run PROC LIFETEST once and capture all plots in an ODS DOCUMENT. Then, use PROC DOCUMENT to replay them individually, changing the name each time.

Also note that the RESET=INDEX option on the ODS GRAPHICS may be useful here. This option will reset the index used on the end of the names. Be sure to use it before specifying IMAGENAME.

Let me know if you have any questions about this approach.

Thanks!
Dan

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1215 views
  • 0 likes
  • 3 in conversation