Data visualization with SAS programming

Name Graphics seperated

Posts: 44

Name Graphics seperated


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
SAS Employee
Posts: 990

Re: Name Graphics seperated

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 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 Smiley Happy

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

Re: Name Graphics seperated

Posted in reply to RobertAllison_SAS
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 Smiley Wink

So is the any chance to name them seperated?
Posts: 975

Re: Name Graphics seperated

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.

Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation