BookmarkSubscribeRSS Feed
wwwz
Calcite | Level 5

The topic was discussed before

https://communities.sas.com/t5/Graphics-Programming/Tidying-up-PNG-files/td-p/492872

 

But I still cannot figure out how to do it.

 

I am outputting graphics into a html file with png files also created and saved. Is there a way to delete these png files at the end of the SAS session, or not save these png files?  I tried deleting the png files but the images in the html file are not shown any more.

Thanks.

 

 

5 REPLIES 5
Tom
Super User Tom
Super User

Did you check the generated HTML code?  Usually images in an HTML file are links to the actual files. So if the files are not accessible the HTML page cannot show the image.

https://www.w3schools.com/tags/tag_img.asp

RichardDeVen
Barite | Level 11

What ODS HTML statement are you using ?

 

The PATH= option tells ODS HTML where to store the html and graphics files.  Store them in the WORK folder and they will go away when the session ends and the work folder is automatically deleted.

 

If you only need to look at output from the most recently submitted code you can also use graphics option RESET(1) to restart image name / numbering, overwriting image files from prior rub code. 

 

Example:

filename workfldr "%sysfunc(pathname(WORK))";

ods html path=workfldr file='gfx.html' style=plateau;

ods graphics / reset=index(1);

proc sgplot data=sashelp.class;
  by name notsorted;
  scatter x=age y=height;
run;

ods html close;

%put NOTE: png are in folder %sysfunc(pathname(WORKFLDR));

 

wwwz
Calcite | Level 5

I am using 

ods html file="xxx.html" path="foldername" gpath="foldername"; So both html and png are saved.

 

Yes, I tried storing png file in work folder, but when I close SAS, then the images in the html file is not shown.

Looks like I have to save those png files. 

ChrisNZ
Tourmaline | Level 20

HTML files do not contain images (unless you use some trickery like base64). They only contain an anchor (a link) to the image file. So deleting the files prevents them from being displayed when opening the HTML file. 

 

If you need a one-file solution, PDF might be a better format.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 1737 views
  • 0 likes
  • 4 in conversation