BookmarkSubscribeRSS Feed
Olivier
Pyrite | Level 9
Hi all.

I'm trying to circumvent what seems to be an undocumented problem : when the ODS gives birth to an ODS file with a table containing the "%anything-", this text is turned into a new line tag (
).
Any text included between the % and the - signs lead to the same result, except for a second % sign, like %%-, which only displays as %- in the final output.

The problem only appears with SAS 9, as it seems to be caused by the ODS HTML4 encoding. In either SAS v8 or ODS HTML3, the problem does not appear.

How can I turn this transformation off without changing neither my ODS destination, nor my text string ?

Example below :

data sample ;
valeur="5.50%-07" ; output;
run ;
ods html body = "C:\temp\testv9.html" ;
proc print data = sample ;
run ;
ods html close;

ods html3 body = "C:\temp\testv8.html" ;
proc print data = sample ;
run ;
ods html3 close;


Thanks in advance.

Olivier
5 REPLIES 5
Eric_SAS
SAS Employee
Adding a % will work. Adding protectspecialchars as a style over ride will also work.

data sample ;
valeur="5.50%-07" ; output;
run ;
ods html body = "testv9.html" ;
proc print data = sample ;
var valeur / style=[protectspecialchars=yes];

run ;
ods html close;

ods html3 body = "testv8.html" ;
proc print data = sample ;
run ;
ods html3 close;
Olivier
Pyrite | Level 9
Hi Eric.

The protectspecialchars style override was something I already thought of ; does not work in this case, since it only seems to protect characters like <, > or & -- which have meaning in HTML.
Anyway, my very concern is WHERE THE HELL is ODS told to transform any %...- string into
? Didn't find any hint of that in the HTML-related tagsets. Is it hard-coded somewhere users cannot access ?

This is just for personnal knowledge, since %% solves the core problem.

Olivier
David_SAS
SAS Employee
The % behavior is a bug, not an undocumented feature. It is fixed in the next SAS 9 release.

-- David Kelley, SAS
Olivier
Pyrite | Level 9
Thank you David.

I'll wait for 9.2 to fix it.
Eric_SAS
SAS Employee
I apologize, I must have run the test with the wrong version of SAS.

protectspecialchars=no

had a good chance of working because the same code that is protecting
those characters is also doing the percent processing. If setting it to
no had cause it to skip that code altogether, it would have been a good
work around.

But it is not.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 836 views
  • 0 likes
  • 3 in conversation