I used ods html path='...' to generate an html with frame, title and body. The body displays well within the sas studio environment, but if I double clicked on frame, it is automatically downloaded to my local computer, so I double click body and title html as well, but when I try to display frame.html with my local browser, it complains the path is not correct (supposedly) as the path displayed is the current path in sas studio plus whatever I assigned to path in the ods statement. Then, comes the question I am asking on the title.
e.g.
File not found
Firefox can’t find the file at /C:/Users/John/Downloads/~/ECRB94/data/output/toc.html.
Here ~/ECRB94/data/output is where sas studio resides in.
We would have to see the code from any statements setting the HTML properties to diagnose anything.
Most likely all the references in the Html code were relative, meaning a location for the body Html file points to other needed bits relative to the location of the body file. When you move (download) such the links are all still relative, they do not point back to the server but now expect everything to be local on your computer. That goes for EVERY link (likely HREF="<stuff here") in the text of the HTML. So images and icons may no longer be in the correct location as well. You can open the HTML with a TEXT editor, the SAS editor will work, and look at the links and change them to point to your local path instead of the server.
Or change how you download stuff.
As mentioned, you may have to move a lot of other stuff as well depending on your code. The only project that I deal with Frames also generates more than 100 html files for the individual content that the frame links to for the body to display.
PATH= specifies the location of the files, and this is also, in absence of a BASE= option, used as the first part in all the links. This is why you find URLs with ~ at the beginning (which Windows misinterprets as relative to the download location)
Specifying
base=""
in the ODS HTML statement should cause the creation of relative links.
Hi,
The issue is that when you create the file on your SAS session, it picks up the full path that you specify which would never be the path that your web admins would use when they moved the files to a web server machine.
Rather than taking the defaults for the path, which will embed your local path into the HREF and SRC attribute for the FRAME and BODY and other files, you can do this -- use the URL=NONE option for each of your files -- as shown below:
This forces ODS to ONLY put the FILE name and extension in the HREF and SRC attributes. That means when you download from the server to your local machine or from your local machine to the web server, this form of reference will expect all the files to be stored in the same location when you open the FRAME file. You should consult with your web server admin before using a BASE= option in your code. The challenge with the BASE= option is that you would not be able to open the files to check whether they were working until all of the files were loaded into the BASE= location. So I only advise doing this AFTER you've done all your testing and AFTER you've made sure that the web admin is providing your with a web server location for all of the files. If your files will have images, you also have to find out from the web admin whether they want the images in a separate folder on the web server or whether they want the images embedded in the HTML using SVG and HTML5.
If you start out with URL=NONE for your testing and initial file creation, you can open them on your SAS server and then when you download them to your local machine, just remember you have to download ALL of the files, the FRAME=, BODY=, CONTENTS= and PAGE= files, they all have to be downloaded together and put into the same location before you open the FRAME= file.
Then once you have things working if the final destination is a web server for reporting purposes, you'll need to work with the web server admin to make sure that they can either deal with the relative names or whether they want you to code a BASE URL.
Cynthia
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.
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.