Usage Note 23566: In ODS HTML output, why is my title or footnote going to multiple lines?
A bug in SAS 8.2 causes titles and footnotes to insert the <BR> HTML tag, which creates a line break. This happens when titles or footnotes are longer than 108 characters, including HTML tags and text. If there are no spaces in the title or footnote, the problem does not
occur regardless of the length of the title or footnote.
This problem is corrected for SAS 9 and beyond.
Prior to SAS 9, you have a few solutions. The first example below uses the tagsets of the ODS MARKUP destination. This problem does not exist with the
experimental Markup destination for SAS 8.2. The second example uses the ASIS=ON style attribute within the Systemtitle Style element for the titles. This prevents the insertion of the <BR> tags. The third example
provides a workaround by replacing all of the blank spaces with the HTML non-breaking space character . This works fine unless you are using an HTML tag that has an attribute such as the image tag (<img src="c:\temp">)
or the font tag (<font color=red>): if the non-breaking space character is placed between the tag and the attribute, the attribute is ignored. In those cases, use code like example 4. Place the word _space_
between the tag and the attribute, which the macro changes back to a regular space.
/* example 1*/
ods htmlcss body="c:\temp.html" stylesheet="c:\temp.css";
proc print data=sashelp.class;
title "a very long title";
run;
ods htmlcss close;
/* example 2*/
proc template;
define style styles.test;
parent=styles.default;
style systemtitle from systemtitle /
asis=on;
end;
run;
ods html file="tmep.html" style=styles.test;
proc print;
title "a very long title";
run;
ods html close;
/* example 3*/
%macro test(var);
%qsysfunc(tranwrd(&var,%str( ),%nrstr( )))
%mend;
ods html file='temp.html';
proc print data=sashelp.class;
title1 "%test(%quote(this is a very long title that will
split when it goes over 108 characters. If the
macro is not used, then this will insert the HTML
line break character. I will now just add
characters to make up the 108 characters.
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz))";
run;
ods html close;
/* example 4*/
%macro test(var);
%let title=%qsysfunc(tranwrd(&var,%str( ),%nrstr
( )));
%qsysfunc(tranwrd(&title,_space_,%str( )))
%mend;
ods html file="temp.html";
proc print data=sashelp.class;
title "%test(%quote
(<font_space_color='red'>aaaaaaaaaaaaaa
ffffffffffff<img_space_src='c:\temp.gif'>ggg
gggggg gggggg ffffffffffffffffffffff ddddddddddddddddfff
ffffffff fffffffffffffffff ggggggggggggggggggggggfffff
ffffffffffffffffffffffffffffff sssssssssssssssssssssss
ssssssssssssssssffffffffff</font>))";
run;
ods html close;
See also the full PROC TEMPLATE FAQ and Concepts.
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: | 2004-01-09 11:58:04 |
| Date Created: | 2003-11-04 16:29:30 |