BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have a program which creates a series of charts, using proc gplot, and then outputs them to an html file. The chart images and html file are all sent to the same folder. I can see that the charts are actually created, and look as they should. But somehow the html doesn't find them and instead gives me the dreaded red X. What could be the problem?
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
The issue is probably the fact that your HTML file is written to your location in FILE=; BUT, the images are written to your working directory. So if you have this (or something like it):
[pre]
ods html file='c:\temp\myfile.html';
...
ods html close;
[/pre]

Then the HTML file would be written to c:\temp, but the images might be some directory like c:\Documents and Settings\etc\etc

One way around it is to use an explicit PATH= and GPATH= option in your code:

[pre]
ods html path='c:\temp' (url=none)
gpath='c:\temp' (url=none)
file='myfile.html';
...
ods html close;
[/pre]

Since HTML builds an IMG tag that is generally expecting a URL for the image location, the suboption (URL=NONE) tells ODS that the physical location c:\temp should NOT be used to build the IMG tag -- that's because if you move the HTML file and the images to a UNIX web server or a MAC web server or a LINUX web server -- they generally do NOT have a C:\ drive and so you don't want a Windows path in the IMG tag.

cynthia
deleted_user
Not applicable
Thanks, Cynthia. I suspect it's the url= option that is causing the problem. I'll check it out when I get back to work on Monday.
Cynthia_sas
SAS Super FREQ
Well, you could have something like this:

[pre]
ods html path='c:\temp' (url="http://www.server.com/rptdir/")
gpath='c:\temp' (url="http://www.server.com/rptdir/")
file='myfile.html';
[/pre]

and then the IMG tag would be:
[pre]

<img alt="VBAR chart of Reg" src="http://www.server.com/rptdir/gchart3.png"
style="height:480px; width:640px;" border="0" usemap="#M299EMM7" class="c">
[/pre]

But then the issue would be that the image output would be sitting down on your C drive and the hyperlink would not work until both files (the HTML and the Image file) were transferred to the server location.

I find the best solution is to make a directory structure on my local machine that "mimics" the directory structure on the server machine. Then I can use relative names that will work down on my C drive and on the server after I move the files there.

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 868 views
  • 0 likes
  • 2 in conversation