BookmarkSubscribeRSS Feed
OS2Rules
Obsidian | Level 7
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.
10 REPLIES 10
ballardw
Super User
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 ()}
Cynthia_sas
SAS Super FREQ
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
Ksharp
Super User
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

Andre
Obsidian | Level 7
[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
Ksharp
Super User
*^_^*


Ksharp
OS2Rules
Obsidian | Level 7
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...)
Tim_SAS
Barite | Level 11
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毙.
Ksharp
Super User
Do you use ^S={asis=on just=left} ?



Ksharp
OS2Rules
Obsidian | Level 7
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.
Tim_SAS
Barite | Level 11
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 4291 views
  • 0 likes
  • 6 in conversation