BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Hi community,

this time I have the question.

I am creating a report via ODS HTML that includes a few png graphics created by proc gbarlin and proc gplot.

I need to specify a distinct basename for the graphics files, because a time series of the report will be written to the same directory, and at the moment the png's from each run are overwritten with the latest results.

Right now I get a gbarlin.png and several gplotX.png.

I want the files to be named report_name_X.png (report_name being the same as in the HTML file, which I already have extracted from the complete path name of the HTML)

I know there must be an option to do that, but I somehow couldn't find it in the SAS doc.

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Kurt

You can use the NAME= option on the individual plot statement to name the file being created. See sample code below.

proc catalog c=work.gseg kill;
run;
quit;

ods html file="c:\temp\sample.html"  gpath="c:\temp" (url=none);

proc gplot data=sashelp.class ;
  plot age * weight / name="sample_";
run;
quit;

proc gbarline data=sashelp.class;
  vbar age / name="sample_";
 
plot / sumvar=height ;
run;
quit;

ods html close;

View solution in original post

2 REPLIES 2
BrunoMueller
SAS Super FREQ

Kurt

You can use the NAME= option on the individual plot statement to name the file being created. See sample code below.

proc catalog c=work.gseg kill;
run;
quit;

ods html file="c:\temp\sample.html"  gpath="c:\temp" (url=none);

proc gplot data=sashelp.class ;
  plot age * weight / name="sample_";
run;
quit;

proc gbarline data=sashelp.class;
  vbar age / name="sample_";
 
plot / sumvar=height ;
run;
quit;

ods html close;
Kurt_Bremser
Super User

Thanks! Just what I needed.

But: for the STAT graphics procedures, a base filename can be set with the ODS GRAPHICS statement.

I feel it would be nice to create a consistent way to set graphics parameters for all ODS output

- select the device (and proper filename extension) with the GOPTIONS statement

- then specify the base filename (along with gpath) in the ODS HTML statement (like gfilename="mygraphics_", which would then create mygraphics_1.ext, mygraphics_2.ext, and so on)

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 840 views
  • 0 likes
  • 2 in conversation