The SAS Output Delivery System and reporting techniques

Suppress ods html output

Reply
Contributor
Posts: 29

Suppress ods html output

My code looks like this:

[pre]
filename odsout &odsout;
ods html style=sasweb path=odsout frame=result.html contents=result_content.html nogtitle;
[/pre]

then I "macro-loop" over some variables and produce various neat graphics for each of the macro variables:
[pre]
%do i=1 %to 5;
%let strategy=strat&i;
ods graphics on /
imagefmt=png
imagemap=&odsimgmap
imagename="bck"
border=off;
ods listing close;
ods html body="&strategy..html" path=odsout gpath=&gpath nogtitle;
options nolabel;
ods proclabel "&strategy";
ods layout start columns=2;
title;
ods region;
proc sgrender data=mydata
template="styles.mygraphs";
run;

ods graphics off;
ods region;
ods proclabel "";
proc report data=Fastbt_riskout_tr(obs=17)nowd;
column quantity &score;
run;
ods layout end;
%end;
ods html close
ods listing;
[/pre]

What happens in the resulting html file result.html is that it nicely creates a table of contents in the left frame, but unfortunately adds an entry in the table of content for every proc I call inside the macro loop. The result is that my table of content is far to big!
What I get is something like this:
1. strat1
2. The Report Procedure
3. strat2
4. The Report Procedure
5. stra3
[...]

What I want is:
1. strat1
2. strat2
3. strat3
4. strat4
5. strat5

Having only two proc calls and five strategies is still bearable, but when there are 100 strategies and six proc calls the Table of Contents is not very nice to look at...
SAS Super FREQ
Posts: 8,864

Re: Suppress ods html output

Hi:
Just as you have
[pre]
ods proclabel " ";
[/pre]

before your PROC REPORT, you can also use the CONTENTS = option to suppress the automatic PROC REPORT entry in the results window and Table of Contents in the TOC file:

[pre]
proc report data=xxx.yyy nowd contents=" ";
[/pre]

as described here:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473620.htm#a003072006
http://support.sas.com/kb/23/428.html (shows PRINT, but REPORT works the same way)
http://support.sas.com/kb/23/337.html (shows tabulate, but contents= also works for PRINT and REPORT -- but on the PROC statement)

If you want to streamline the ODS HTML table of contents further than you can achieve with the above techniques, then you can also modify the style template, as shown in these notes:
http://support.sas.com/kb/23/345.html
http://support.sas.com/kb/23/344.html

cynthia
Contributor
Posts: 29

Re: Suppress ods html output

mhm. The documentation says that contents="" for proc report and description="" suppress an entry in the table of contents html file. In my case (SAS 9.2) it has absolutely no effect.

after
[pre]
ods html body= ...
[/pre]
I start a ods layout and then
issue a ods proclabel and the an proc sgrender. For this first graph i want a table of contents entry . Then after this I sent a proc report and a bunch of proc sqplot (you never can have enough graphical output...) All of output will display in the body and have entry in the table of contents -no matter if contents="" or description="" is written to the respective procs.

I tried to change the template to see if changes here will affect anything:
[pre]
proc template;
define style styles.sasweb2;
parent=styles.sasweb;
style ContentTitle from Index;
style ContentProcname from Index /
bullet=none;
end;
run;
[/pre]

Also here I didn't notice any changes to the table of contents (I restarted SAS a couple of times). I had difficulties to find documentation on the used style elements "ContentTitle" and "ContentProcname", maybe some magic options exists...Any ideas?
Contributor
Posts: 29

Re: Suppress ods html output

What I really want is to produce one entry in the table of contents frame for each ods html body=... statement (and not for every proc call inside the body file)
Super Contributor
Super Contributor
Posts: 3,174

Re: Suppress ods html output

Explore the various ODS HTML statement options - you will find one that controls how the TOC is created. Also, review the CONTENTS= as well, but the TOC hyperlink text generated by SAS is quite rudimentary and crude.

You really will want to consider using a combination of one ODS HTML statement with multiple PROC invocations using WHERE and/or BY statement processing in order to generate a meaningful TOC pane/window, in my opinion.

Scott Barry
SBBWorks, Inc.
Super Contributor
Super Contributor
Posts: 3,174

Re: Suppress ods html output

Here is some SAS-hosted support documents, supplemental to the product documentation on ODS. Suggest you bookmark this page as a favorites for future reference.

Scott Barry
SBBWorks, Inc.

Base SAS
SAS Notes and Concepts for ODS
http://support.sas.com/rnd/base/ods/templateFAQ/index.html
SAS Super FREQ
Posts: 8,864

Re: Suppress ods html output

Hi:
Every PROC call -will- generate an entry in the TOC -- unless you take other measures like CONTENTS= to deal with it. I am surprised that CONTENTS= doesn't work for ODS HTML when you're also using ODS LAYOUT. This is a question to pursue with Tech Support.

There are template methods to suppress TOC entries. What you might try is using ODS HTML3 (HTML 3.2 tags) instead of ODS HTML (HTML 4.0 tags) and see whether the HTML is different. ODS HTML3 is the original destination and it's possible that it might work different.

Another place where you have a chance to impact the output (for ODS HTML) is to modify the tagset template (tagsets.html4) that actually -generates- the TOC file. You could alter the events that are writing to the TOC file and change so that ONLY the BODY events wrote to the TOC file instead of the PROC events. This is not a trivial undertaking -- so it wouldn't be my first choice to try.

Other than that, there might be a chance that ODS DOCUMENT and PROC DOCUMENT would allow you to build the TOC structure you want. The catch here is ODS LAYOUT -- I don't know how/whether the ODS LAYOUT statements will go into the document store -- again -- this is a question for Tech Support.

And, of course, there's always the DATA step method. If you are happy with the FRAME and BODY files and your only issue is with the CONTENTS file, you can always wait until the "big" step is done and then write over the CONTENTS= file with a file of your own that has the links you want. By the time your macro is over, you should know the name of each BODY= file. The HTML that you need for the TOC is very straightforward. This would have to be the very LAST step -- after everything else is done and the "bad" CONTENTS= file was closed. Then you could write your own HTML CONTENTS= file to subsitute instead of the "bad" one.

cynthia
Contributor
Posts: 29

Re: Suppress ods html output

ok, I went for the data step version and write out my own TOC. Looks good... thank you for all help!
Ask a Question
Discussion stats
  • 7 replies
  • 313 views
  • 0 likes
  • 3 in conversation