The SAS Output Delivery System and reporting techniques

ODS Add Spaces to Title in HTML

Reply
Super Contributor
Posts: 358

ODS Add Spaces to Title in HTML

Hi All:

I thought that this would be easy, but apparently, I was wrong...

All I want to do is add some "white" space between 2 words in a title.

Because the output is HTML, if I just use spaces, I would need about a million to get an inch of white space, and that is not worth it.

I used the escapechar="^" and the "^_" which adds a "nbsp;" (with an ampersand) between the words, but this really messes up the title (causes the title to wrap and removes the justification!)

(I'm using v9.1.3)

Thanks in advance.
Super User
Posts: 11,343

Re: ODS Add Spaces to Title in HTML

You may be looking for the function NBSPACE which lets you insert a specified number of spaces into text. You may need to use TEXT instead of TITLE though.

^{NBSPACE ()}
SAS Super FREQ
Posts: 8,868

Re: ODS Add Spaces to Title in HTML

Hi:
I believe the ESCAPECHAR {NBSPACE} function was a "new" with 9.2 feature. I do not think it was available before 9.2.

Also, you did not say whether you were using ODS HTML, ODS HTML3 or ODS MSOFFICE2K as your ODS destination. All of those destinations, including ODS PHTML and ODS CHTML create HTML output results.

cynthia
Super User
Posts: 10,044

Re: ODS Add Spaces to Title in HTML

Hi.You need the proper style .
[pre]








[/pre]


ods html file='c:\peter.html' style=sasweb;



ods escapechar='~';



 title   "~S={asis=on}            
This is a     
test      

"
;



 proc print data=sashelp.class;



 run;



ods html close;
[pre]


[/pre]

Ksharp

Super Contributor
Posts: 273

Re: ODS Add Spaces to Title in HTML

[pre]
It seems that for 9.2
the nbspace function is working for every html output except chtml one
in title or ods text= instruction
[/pre]

Andre



ods escapechar="^";



ods chtml
file='d:\temp\ksharp1.html'

;



ods phtml
file='d:\temp\ksharp2.html'
;



ods msoffice2k

file='d:\temp\ksharp3.html'
;



ods html
file='d:\temp\ksharp0.html'
style=sasweb;



 title  j=L "This is a      test
^{NBSPACE 15}  Other text     "
;



 proc print data=sashelp.class;



 run;



 ods text="This is a      test ^{NBSPACE 45}  Other text    

"
;



 proc print data=sashelp.class(obs=1);run;



ods _all_
close;



ods listing;



 



Message was edited by: Andre
Super User
Posts: 10,044

Re: ODS Add Spaces to Title in HTML

*^_^*


Ksharp
Super Contributor
Posts: 358

Re: ODS Add Spaces to Title in HTML

Thanks all for the help....but:

Firstly, I am using 9.1.3 so the NBSPACE is not available to use.

Secondly I am using ODS HTML to create the report ( from a PROC PRINT).

My original title statement looks like this:

title2 .j=c "Environment: &report_environment Group: &report_group";

and it generates the following HTML code:

Environment: Production Group: Incidents

But when I use the ESCAPECHAR with the code:

title2 .j=c "^S={asis=on} Environment: &report_environment Group: &report_group";

I get the following HTML:

Environment: Production Group: Incidents

Which ignores the justification of the title and wraps the code onto 2 lines.

(sorry about the formatting - somehow it got messed up...)
Super Contributor
Posts: 394

Re: ODS Add Spaces to Title in HTML

The HTML you show does not contain any codes that would cause the title to wrap. Your web browser may be wrapping the text because the window is too narrow to show the text on a single line. What happens when you increase the width of your browser window?

It would help if you would post a complete example that reproduces the problem. Surround your example with [pre] and [/pre] to use a monospace font and retain the indents and line breaks.

Here's a note about the markup used in these forums: http://support.sas.com/forums/thread.jspa?messageID=27609毙.
Super User
Posts: 10,044

Re: ODS Add Spaces to Title in HTML

Do you use ^S={asis=on just=left} ?



Ksharp
Super Contributor
Posts: 358

Re: ODS Add Spaces to Title in HTML

Thanks to all that have replied.

(And thanks for the link the formatting).

I have been trying various things with no success. I will post more of the code
and hopefully the formatting will help.

When I use this code:

[pre]

title1 .j=l ''
.j=c "Mean Time To #byval(title_group) - by &report_label";

title2 .j=c h=12pt "Environment: &report_environment Group: &report_group";

[/pre]

I get this in the HTML ouput:

[pre]














Mean Time To Deliver - by Category  
Environment: Production Group: Service Requests



[/pre]

When the HTML is viewed, the spaces virtually disappear.

But when I run this code:

[pre]

title1 .j=l ''
.j=c "Mean Time To #byval(title_group) - by &report_label";

title2 .j=c h=12pt "^S={asis=on} Environment: &report_environment Group: &report_group";

[/pre]

I get this as the HTML code:

[pre]














Mean Time To Deliver - by Category  
Environment: Production Group: Service Requests



[/pre]

Note the change to the HTML code for title2 - but it is no longer centered - and the spacing is the same as before

Hope this is more descriptive of the problems I'm having.
Super Contributor
Posts: 394

Re: ODS Add Spaces to Title in HTML

I see what you're seeing at 9.1.3 and I confirmed that it works properly with 9.2. I suggest you talk to Tech. Support and install the latest version of the HTML tagset.
Ask a Question
Discussion stats
  • 10 replies
  • 1349 views
  • 0 likes
  • 6 in conversation