BookmarkSubscribeRSS Feed
Lapis Lazuli | Level 10

I'm creating HTML and RTF graphics output which produces lots of PNG files (SAS 9.4 TS1M5). Is there a way to get these all deleted at the end of the SAS session?  My setup commands are currently:

ods graphics on /reset=index outputfmt=PNG;
ods rtf  file="[filename].rtf"  image_dpi=300 ;
ods html gpath="[foldername]"  image_dpi=300;
Super User
If you don’t need them try setting gpath to the work library. HTML files may need them though, so check that first.
Lapis Lazuli | Level 10

1) How can I specify the work folder in the gpath option?

2) I currently have a gpath statement in my ods html statement. I get new png files appearing in this folder. However, I also get them appearing in the same folder as the SAS program. (Except these files are smaller and in b&w rather than colour).

Super User

Do you have ODS LISTING destination open or a different one while exporting to HTML/RTF? That may be why those are generated.

You can get the work path by using the following:

%let wpath = %sysfunc(pathname(work));
%put &wpath;
Opal | Level 21

ODS RTF doesn't create PNG files but ODS HTML and ODS LISTING do. The HTML main file will refer to those PNG files. If you delete them they won't show in your HTML pages. If neened, you can temporarily stop and restore the production of graphic files in your listing output with ODS LISTING SELECT NONE; and ODS LISTING SELECT ALL;

Lapis Lazuli | Level 10


  • ODS listing is closed. (If I use the command Ods listing select none, I get an error message 'The Listing destination is not active').
  • If I right click on the results window and choose source I get the html code for that page. Searching this, I don't find any reference to the png files that appeared in the current program directory.
Lapis Lazuli | Level 10

I think I've worked out where they're coming from. I also have

ods markup tagset=ExcelXP

Even though I couldn't see in graphs in the Excel file created, it was (trying) to link to them. I'll see if tagset=Excel works better.

Thanks all for your suggestions.

Super User

If you're in a later version of SAS, 9.4TS1M3+ you can use ODS EXCEL instead of TAGSETS which supports pictures.

Lapis Lazuli | Level 10

Sorry, that's what I meant: ODS Excel (not ODS tagsets=excel). This has fixed the problem (and does a better job than tagsets=excelxp).

Thanks all.



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
  • 8 replies
  • 3 in conversation