BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ahirt845
Calcite | Level 5

I'm following along with The Little SAS Book and I've reached section 5.5 Creating HTML Output. When I put the code that it says to use in and run it, the Results Viewer window pops up with a horizontal frame, similar to how it looks in the book, but no data appears... the page is blank. I've trying opening it in Internet Explorer, and Chrome as well, but it gives me the same thing and doesn't display the data. I Googled my issue for about an hour and got no where with it. Does anyone else have this problem? The code I'm using is below-

*5.5 Creating HTML Output

*Create the HTML files and remove procedure name;

ODS HTML;

ODS HTML STYLE = D3D BODY = 'C:\Users\amanda\Desktop\SAS Practice\Lengths8.html'

  FRAME = 'C:\Users\amanda\Desktop\SAS Practice\Lengths8.html'

  CONTENTS = 'C:\Users\amanda\Desktop\SAS Practice\Lengths8.html';

ODS NOPROCTITLE;

DATA marine;

  INFILE 'C:\Users\amanda\Desktop\SAS Practice\Lengths8.txt';

  INPUT Name $ Family $ Length @@;

RUN;

PROC MEANS DATA = marine MEAN MIN MAX;

  CLASS Family;

  TITLE 'Whales and Sharks';

RUN;

PROC PRINT DATA = marine;

RUN;

ODS HTML CLOSE;

I attached a picture to this post so you can see what I'm talking about, but there isn't too much to see... just a blank page.

Please help!

Alex


sasods.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Generally speaking, you provide 3 different names when you use BODY= CONTENTS= and FRAME= ... you have the SAME name. So ODS has gotten confused. You asked for 3 separate files, but you gave all 3 files the same name. Try this (note that the c:\<...> is the place where you put in the physical path where you are writing the output files):
      

ODS HTML STYLE = D3D BODY = 'C:\<...>\Lengths8_body.html'
  FRAME = 'C:\<...>\Lengths8_frm.html'
  CONTENTS = 'C:\<...>\Lengths8_toc.html';

  
  proc print data=sashelp.cars(obs=3);
  run;

  proc freq data=sashelp.cars;
    tables type;
  run;

ods html close;

And, then, the file you must open is the FRAME= file because the FRAME= file is the "organizing file" that will hold and display the other 2 files (BODY= and CONTENTS=). By default, SAS will show you the BODY= file, but it will be faster if you go to your storage/output location and just double click on the FRAME= file from Windows Explorer.

Now, the cold shock of "real life usage" -- as cool as the HTML FRAME= stuff is, the chances are good that your company web master will NOT want you to put the files created by ODS on a company web site because 1) they are pure HTML 4.0 compliant HTML Frame navigation tags and 2) most web masters deliver "frame" content with different navigation methods than pure HTML FRAMEs...so, just take that example with a grain of salt.

  If you find you still have issues, you might need to incorporate PATH= (and possibly GPATH=) options into the mix. Shown below if the simple code above does not work. Just remember -- you will need to go find the FRAME= file and open it. The SAS Results Viewer does not show you the FRAME= file by default. It wants to show you the BODY= file by default.

    

ODS HTML STYLE = D3D PATH='C:\<...>\' (URL=NONE) GPATH='C:\<...>\' (URL=NONE)

  BODY = 'Lengths8_body.html'
  FRAME = 'Lengths8_frm.html'
  CONTENTS = 'Lengths8_toc.html';

  
  proc print data=sashelp.cars(obs=3);
  run;

  proc freq data=sashelp.cars;
    tables type;
  run;

ods html close;

cynthia

View solution in original post

3 REPLIES 3
ballardw
Super User

I don't have the source book you mention. Does the example actually have the exact same file for the body, contents and frame? That looks a little odd to me, most examples I've seen with those options have 3 separate files.

Cynthia_sas
SAS Super FREQ

Hi:

  Generally speaking, you provide 3 different names when you use BODY= CONTENTS= and FRAME= ... you have the SAME name. So ODS has gotten confused. You asked for 3 separate files, but you gave all 3 files the same name. Try this (note that the c:\<...> is the place where you put in the physical path where you are writing the output files):
      

ODS HTML STYLE = D3D BODY = 'C:\<...>\Lengths8_body.html'
  FRAME = 'C:\<...>\Lengths8_frm.html'
  CONTENTS = 'C:\<...>\Lengths8_toc.html';

  
  proc print data=sashelp.cars(obs=3);
  run;

  proc freq data=sashelp.cars;
    tables type;
  run;

ods html close;

And, then, the file you must open is the FRAME= file because the FRAME= file is the "organizing file" that will hold and display the other 2 files (BODY= and CONTENTS=). By default, SAS will show you the BODY= file, but it will be faster if you go to your storage/output location and just double click on the FRAME= file from Windows Explorer.

Now, the cold shock of "real life usage" -- as cool as the HTML FRAME= stuff is, the chances are good that your company web master will NOT want you to put the files created by ODS on a company web site because 1) they are pure HTML 4.0 compliant HTML Frame navigation tags and 2) most web masters deliver "frame" content with different navigation methods than pure HTML FRAMEs...so, just take that example with a grain of salt.

  If you find you still have issues, you might need to incorporate PATH= (and possibly GPATH=) options into the mix. Shown below if the simple code above does not work. Just remember -- you will need to go find the FRAME= file and open it. The SAS Results Viewer does not show you the FRAME= file by default. It wants to show you the BODY= file by default.

    

ODS HTML STYLE = D3D PATH='C:\<...>\' (URL=NONE) GPATH='C:\<...>\' (URL=NONE)

  BODY = 'Lengths8_body.html'
  FRAME = 'Lengths8_frm.html'
  CONTENTS = 'Lengths8_toc.html';

  
  proc print data=sashelp.cars(obs=3);
  run;

  proc freq data=sashelp.cars;
    tables type;
  run;

ods html close;

cynthia

ahirt845
Calcite | Level 5

That answer couldn't have been any better and I got it working thanks to your advice. Thank you for that, I really appreciate it. This is a great community.

Alex

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5827 views
  • 4 likes
  • 3 in conversation