then I "macro-loop" over some variables and produce various neat graphics for each of the macro variables:
%do i=1 %to 5;
ods graphics on /
ods listing close;
ods html body="&strategy..html" path=odsout gpath=&gpath nogtitle;
ods proclabel "&strategy";
ods layout start columns=2;
proc sgrender data=mydata
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:
2. The Report Procedure
4. The Report Procedure
What I want is:
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...
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.
ods html body= ...
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:
define style styles.sasweb2;
style ContentTitle from Index;
style ContentProcname from Index /
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?
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.
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.