Usage Note 23395: In ODS HTML output, how can I left-justify everything in the table of contents?
To left justify the entire output in the table of contents in SAS 9.1, you must modify the HTML4 tagset. The HTML4 tagset is modified to add the CLASS= HTML attribute to the ordered list (<OL>) tag. This enables you to add a margin property to the Contents style elements which will left justify the body
of the table. The margin properties do not get passed to the Contentsitem and the contents folder until you update the Margins event to control the margins individually. The following example code is for SAS 9.1. The second example is for SAS 8.2.
/* example for SAS 9.1 */
proc template;
define tagset tagsets.leftjusttoc;
parent=tagsets.html4;
define event listclass;
putq " class=" HTMLCLASS;
end;
define event margins;
put " text-indent: " indent;
put " text-indent: " indent;
put ";" NL / exists( indent);
put ";" NL / exists( indent);
put " margin-left: " LEFTMARGIN;
put ";" NL / exists( LEFTMARGIN);
put " margin-right: " RIGHTMARGIN;
put ";" NL / exists( RIGHTMARGIN);
put " margin-top: " TOPMARGIN;
put ";" NL / exists( TOPMARGIN);
put " margin-bottom: " BOTTOMMARGIN;
put ";" NL / exists( BOTTOMMARGIN);
end;
end;
run;
proc template;
define style styles.test;
parent=styles.default;
style contentfolder from contentfolder /
leftmargin=0;
style contents from contents /
leftmargin=0;
style contentitem from contentitem /
leftmargin=3;
style contentprocname from contentprocname /
bullet=none
leftmargin=0;
style bycontentfolder from bycontentfolder /
leftmargin=0;
end;
run;
ods tagsets.leftjusttoc path="C:\"(url=none) file="body.html"
contents="contents.html" style=styles.test ;
proc print data=sashelp.class;
run;
proc freq data=sashelp.class;
run;
ods tagsets.leftjusttoc close;
As you can see from the example code below, most of the information in the table of contents can be left-justified by specifying the attribute LEFTMARGIN. However, modifying ContentItem requires the use of a cascading style sheet. In the example code, the HTMLCLASS= attribute specifies the style MARGIN-LEFT :1 for the style element ContentItem. View output. (This can also be done by using tagsets beginning in Release 8.2; see SAS Note 23611.)
/* example for SAS 9.1 */
proc template;
define style styles.test;
parent=styles.default;
style contentprocname from indexprocname /
background=cxb0b0b0
bullet=none;
style contents from document /
background=cxb0b0b0
leftmargin=1;
style contentfolder from indexfolder /
background=cxb0b0b0
leftmargin=1;
style contentitem from indexitem /
background=blue
htmlclass='ContentItem {margin-left:1 }';
end;
run;
ods html body='temp.html' contents='temp1.html'
style=styles.test
stylesheet="temp.css"(url="temp.css");
proc print data=sasuser.class;
run;
ods html close;
See also the full SAS Notes and Concepts for ODS.
Operating System and Release Information
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Usage Note |
| Priority: | low |
| Topic: | SAS Reference ==> ODS (Output Delivery System) Third Party ==> Output ==> HTML
|
| Date Modified: | 2005-10-27 11:10:40 |
| Date Created: | 2003-08-19 11:55:32 |