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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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