BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
YasodaJayaweera
Obsidian | Level 7

I am trying to write the output of two proc print statements into a HTML file. However, I am unable to view the html file in the proper format.

 

ods html body='/home/u48733392/Mock test/data.html'
 contents='/home/u48733392/Mock test/toc.html'
 frame='/home/u48733392/Mock test/frame.html';
 
proc print data=cert.admit (obs=10) label;
	var id sex age height weight actlevel;
	label actlevel='Activity Level';
run;

proc print data=cert.stress2 (obs=10); 
	var id resthr maxhr rechr;
run;

ods html close;

I am trying to follow an example activity given in 'SAS certified specialist prep guide: base programming using SAS 9.4' prep guide and I executed the code in SAS studio. THe expected output is below.

f.JPG

 

As per the guide in order to to view the frame file that integrates the body file and the table of contents, select File -> Open from within the internal browser or your preferred web browser.When I follow these instructions all I can see is a blank page with 2 frames (please see below).

f1.JPG

I tried openinig the format.htm file in Edge, IE, Firefox and Chrome but the result is still the same. Can someone please help me figure out why the frame.html file is not displaying the content in the 2 frames?

 

P.S. When I open data.html and toc.html displays the respective content seperately.

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  When you're working on a server (such as the SAS OnDemand server) you have to change the code that's in the Prep Guide to use PATH=, as shown below:

Cynthia_sas_0-1655947816449.png

 

  Then with the (URL=NONE) option added for the PATH= option, you are essentially telling ODS HTML to use HREF tags that only contain the file name and file extension, but NOT any of the Unix path for the SAS OnDemand server. Notice that I stored the files in my SAS OnDemand folder  named all_output under my /home location.

 

  Then before you open FRAME.HTML, you need to download all 3 files, bod.html, toc.html and frame.html from the folder on the OnDemand server down to your machine. I just took the defaults and downloaded my files to my Downloads folder on Windows:

Cynthia_sas_1-1655948045109.png

  Then, once all 3 files were finished downloading I double-clicked to open frame.html and the HTML page with the frame navigation worked as expected:

Cynthia_sas_2-1655948115567.png

 

  The use of PATH= and possibly GPATH= with (URL=NONE) most always need to be used with this kind of frame navigation -- especially when you are moving the created files from one machine to another or from your personal machine to a web server machine.

  I'm not sure which Prep Guide you're studying for the Base Programmer exam, however, in the topics listed in the content guide for the exam, you should note that there's no mention of using FRAME= or CONTENTS= or BODY= in this use case in the content guide that you find here: https://www.sas.com/content/dam/SAS/documents/technical/certification/content-guide/specialist-base-... the ODS topics that you need to prepare for are shown below:

Cynthia_sas_3-1655948515650.png

 

  So I would recommend not stressing over creating FRAME navigation files with ODS HTML.

 

Cynthia

 

View solution in original post

4 REPLIES 4
ballardw
Super User

You have missed a very crucial part. Please refer to the second picture and read the FILE name. Compare that to the names of the files created in your code.

 

Step missed: Downloaded from where the files were created to a WINDOWS system. Then tried to open them.

 

HTML uses HREF (and possibly other) tags in the body of code to tell the browser where to look for the linked items. If you open your file with a TEXT editor you will find strings in the generated html that look like

 '/home/u48733392/Mock test/toc.html'
 '/home/u48733392/Mock test/frame.html'

 You would need to make sure that the "/home/u48733392/Mock test/" is replaced with a path that the browser can find, either to look like that "C:\users\....\downloads" or provide a complete URL to a server that has the file and will accept requests so that when you attempt to view the output after downloading the links can be made.

YasodaJayaweera
Obsidian | Level 7

Thank you for the explanation. I tried changing the file path however it did not work for some reason. The other solution was much easier since I do not have to meddle with file paths.

Cynthia_sas
SAS Super FREQ

Hi:

  When you're working on a server (such as the SAS OnDemand server) you have to change the code that's in the Prep Guide to use PATH=, as shown below:

Cynthia_sas_0-1655947816449.png

 

  Then with the (URL=NONE) option added for the PATH= option, you are essentially telling ODS HTML to use HREF tags that only contain the file name and file extension, but NOT any of the Unix path for the SAS OnDemand server. Notice that I stored the files in my SAS OnDemand folder  named all_output under my /home location.

 

  Then before you open FRAME.HTML, you need to download all 3 files, bod.html, toc.html and frame.html from the folder on the OnDemand server down to your machine. I just took the defaults and downloaded my files to my Downloads folder on Windows:

Cynthia_sas_1-1655948045109.png

  Then, once all 3 files were finished downloading I double-clicked to open frame.html and the HTML page with the frame navigation worked as expected:

Cynthia_sas_2-1655948115567.png

 

  The use of PATH= and possibly GPATH= with (URL=NONE) most always need to be used with this kind of frame navigation -- especially when you are moving the created files from one machine to another or from your personal machine to a web server machine.

  I'm not sure which Prep Guide you're studying for the Base Programmer exam, however, in the topics listed in the content guide for the exam, you should note that there's no mention of using FRAME= or CONTENTS= or BODY= in this use case in the content guide that you find here: https://www.sas.com/content/dam/SAS/documents/technical/certification/content-guide/specialist-base-... the ODS topics that you need to prepare for are shown below:

Cynthia_sas_3-1655948515650.png

 

  So I would recommend not stressing over creating FRAME navigation files with ODS HTML.

 

Cynthia

 

YasodaJayaweera
Obsidian | Level 7

Thank you very much for the detailed answer. This worked and I was able to view the file.

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