The SAS Output Delivery System and reporting techniques

ODS alchemy (%- turned into carriage return)

Reply
Super Contributor
Posts: 260

ODS alchemy (%- turned into carriage return)

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
SAS Employee
Posts: 95

Re: ODS alchemy (%- turned into carriage return)

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;
Super Contributor
Posts: 260

Re: ODS alchemy (%- turned into carriage return)

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
SAS Employee
Posts: 174

Re: ODS alchemy (%- turned into carriage return)

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

-- David Kelley, SAS
Super Contributor
Posts: 260

Re: ODS alchemy (%- turned into carriage return)

Thank you David.

I'll wait for 9.2 to fix it.
SAS Employee
Posts: 95

Re: ODS alchemy (%- turned into carriage return)

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.
Ask a Question
Discussion stats
  • 5 replies
  • 113 views
  • 0 likes
  • 3 in conversation