Dear ODS experts,
I am struggling with the customization of the table of contents that is automatically generated by SAS when combining multiple PROC REPORT statement.
The aim of my program is to generate a SAS Data Dictionary of all the datasets available in all the libnames which are available at the moment my program is executed. I am generating one HTML file per SAS dataset available in the libraries (using an "ODS HTML Body" statement inside a macro do loop). This part works as expected.
I have also coded my PROC REPORT" statement inside the macro do loop, in order to populate the BODY part of each individual HTML file with the related data. As expected, each execution of this "PROC REPORT" generates a level2 node in my Table Of Contents (displaying the full name of the related SAS dataset, for instance "WORK.INPUT_DATA" and "WORK.OUTPUT_DATA"). I managed to give the expected name to those level2 nodes of my TOC by using the < contents="&Lib..&DsName" > option in the PROC REPORT statement.
What is not appearing as expected is the repetead level1 entries for each ODS HTML file that is generated. I would like to have only one iteration of the same level1 node (corresponding to an individual libname which is available in my session) in the TOC. I define the value of the level1 nodes by using an ODS proclabel statement < ODS PROCLABEL "&Lib"; >
So taking into account the two datasets mentioned above (i.e. "WORK.INPUT_DATA" and "WORK.OUTPUT_DATA"). I would like to have a unique level1 node "WORK" under which my two level2 nodes "WORK.INPUT_DATA" and "WORK.OUTPUT_DATA" will be indented.
Here below, a small representation of what I would like to build as TOC for my data dictionary:
1) WORK
° WORK.INPUT_DATA
° WORK.OUTPUT_DATA
2) TEST
° TEST.MY_DATA
° TEST.MY_OLD_DATA
... etc
You can find a capture of my current TOC in attachment.
It's really important to me that SAS keeps on creating a specific HTML document by SAS dataset (i.e. I don't want all SAS datasets of a same library to be exported in the same HTML document. Each document being linked to the same TOC, which is displayed in a frame document (this part works with my current code). My problem is thus to "simply" group all datatesets referenced by the level2 entries of the TOC, below the level1 entry of the TOC to which they belong (knowing that the level1 entries of the TOC the are library names).
Thanks a lot in advance for your help!
Regards,
Florent
Hi Cynthia,
Thanks a lot for the quick answer!
I am going to give it a try on tomorrow as soon as I arrive at the office. I thought that the PROC DOCUMENT was only to be used with ODS PDF/RTF.
I am busy reading the SAS book you wrote to about ODS, it's crystal clear so far. Very well explained, congratulations.
Florent
Hello Cynthia,
Could you please review my code (in attachment) and let me know whether it would be possible to enhance the results as described below?
I have spent a lot of time searching for solutions by myself (with the support of books and SUGI's) but could not manage to have it work as I want. Really frustrating... So my last shot is by asking to the SAS community.
Thanks a lot in advance for your support.
Kind regards,
Florent
Hi:
I forget the version where the extra "Table 1" node was created by PROC REPORT, maybe it was 9.2, but I believe you need to delete that node BEFORE you save your results in the document store. This Tech Support note has an example of the code you use:
http://support.sas.com/kb/31/278.html
When I use the technique described in the note and save the output to an ODS DOCUMENT store and then replay the output, I do not get a stray Table 1 node.
I am on other projects this week and not in a position to review such lengthy or complex code especially since it cannot be run without making significant changes and creating test files and formats. It also appears that every reference to a Desktop location has to be changed. Plus, diving into code like this without an idea of either the current results or the desired results makes it harder to connect code to output.
However, when I test building and using a URL and a FILE drilldown in a much simpler program, without the TOC, or a document store or macro coding, the links in the program below all work for me.
I'm sure that you started with a working SAS program that had working links before you "macro-ized" the program. So at what point in the process did the URL and the PATH break? If you started with a working SAS program and if all the links worked before you macro-ized the program, then you can probably backtrack to the point where the links broke.
When I run this program (below), the HTTP links and the FILE links all work for me. So there must be something happening to your links when you build them to cause them to break--perhaps there is a place where one of the variables you concatenate to make the path is missing for some row. You could probably debug this by undoing all the NOPRINTs in PROC REPORT to see what's going on.
Like I said at the beginning, I think the Tech Support note above will get rid of the Table 1 node for you. I hope this points you toward some resolution. Otherwise, for more in-depth help, you might need to work with Tech Support.
cynthia
proc sql;
create table DSinfo as
select * from dictionary.tables
where libname='SASHELP' and MEMNAME in ('CLASS' 'SHOES');
quit;
** make some files to drill down to;
ods html file='c:\temp\class_contents.html';
proc contents data=sashelp.class;
run;
ods html close;
ods html file='c:\temp\shoes_contents.html';
proc contents data=sashelp.shoes;
run;
ods html close;
ods html path='c:\temp' (url=none)
file='main.html';
proc report data= DSinfo
contents= '' nowindows split='*';
column libname memname path drilldown crdate modate nobs obslen nvar;
define Path / computed "Test URL with Google";
define drilldown / computed 'Drill Down To';
compute path / character length=100;
hipath='http://www.google.com#q=';
path=catt('<a href="',hipath,memname,'"> The search is: ',memname,'</a>');
endcomp;
compute drilldown / character length=100;
hipath2='file:///c:\temp\';
drilldown=cat('<a href="',trim(hipath2), trim(memname),'_contents.html">', trim(memname),' contents</a>');
endcomp;
compute before _page_ / style=Header{just=l fontweight=bold};
line 'Libname: SASHELP';
line '<a href="http://support.sas.com/training">Go To Training</a>';
line '<a href="file:///c:\temp\shoes_contents.html"> Look At Shoes</a>';
line '<a href="file:///c:\temp\class_contents.html"> Look At Class</a>';
endcomp;
run;
ods html close;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.