- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Many people want to remove certain HTML elements generated by ODS HTML, but how do you add an HTML element?
Example: How does one add an horizontal rule (<HR> ) before and after some PROC ODSTEXT output?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi;
Although RAW might work for HTML and RTF, I found that just using the tags in a TITLE and FOOTNOTE will also work. When you do insert HTML tags, you also need to remember to do a PROTECTSPECIALCHARS=OFF so that the HTML tag brackets are not "protected" by ODS:
Hope this helps.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
There is something going on with my two SAS environments that is preventing this from working. That is using "^{raw …}", using "^S={protectspecialchar=off>…" and "^{style[protectspecialchars=off] …}".
BTW, if the DIV tags are supposed to surround the HR then should it not be: ?
<div><hr/></div> ^
The loose parsing rules of HTML in web browsers probably interprets it correctly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, yes, that should have been a /div at the end of the statement, my bad.
The ^S={xxx=yyy} is the original ESCAPECHAR syntax. the ^{style[xxx=yyy] .... } is the newest syntax for ESCAPECHAR. I have used the ^{raw} with HTML tags but not for just a HR. However, since you don't show all your code it's hard to comment. I started with the simplest approach first to do what you want, which was just to put horizontal rule on either side of the table. More advanced requirements might need the use of ^{raw} -- but protectspecialchars=off should always be specified, either in a style override or in a style template when you use HTML tags or RTF control strings.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
OK, got it to work with SAS Batch... But it doesn't work at all when I insert it into my code of ~650 lines, using SAS Batch.
My process in summary: I tried my code SAS batch, didn't work. Then tried this in Enterprise Guide, trying to keep it simple, using only your code, didn't work! Then I tried your code, keeping it simple, in SAS Batch, -- it works -- ( ^{Raw...} works as well @ballardw ).
Now something is happening in my code that breaks this feature. And that may be out of the scope of this article.
Both of you helped solve this, thanks. If I find out something useful I'll post it here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I could not get this to work:
ods escapechar= "^";
title1 "^{style[protectspecialchars=off] <div><hr/></div>}";
footnote "^{style[protectspecialchars=off] <div><hr/></div>}";
proc odstext;
p "Note: the following totals should add together:" ;
p "14B + 14C + 14E + 14F = 15B" / style=[color=purple fontsize=15pt];
run;
title;footnote;
but I could get this to work:
ods escapechar= "^";
proc odstext;
p "^{style[protectspecialchars=off] <div><hr/></div>}";
p "Note: the following totals should add together:" ;
p "14B + 14C + 14E + 14F = 15B" / style=[color=purple fontsize=15pt];
p "^{style[protectspecialchars=off] <div><hr/></div>}";
run;
I still don't know the reason behind why @Cynthia_sas's solution does not works in my code when using title and footnotes. But I did succeed in putting the horizontal rules where I wanted them in the output.
Thanks again, for the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This small sample worked in my SAS Batch SAS environment, but not in my Enterprise Guide environment:
ods noproctitle escapechar= "^" ;
ods html style=Festival ;
title "^{style[protectspecialchars=off] <div><hr/></div>}";
footnote "^{style[protectspecialchars=off] <div><hr/></div>}";
proc odstext data=sashelp.class(obs=1) ;
p 'Student Info' / style=systemtitle ;
list ;
item 'Student name is ' || name ;
item 'Age: ' || put (age , 2. ) ;
item 'Sex: ' || trim(sex) ;
item 'Height: ' || put(height , 5.1 ) ;
end;
run;
title ; footnote ;
proc odstext data=sashelp.class(FIRSTOBS=2 obs=2) ;
p 'Student Info' / style=systemtitle ;
list ;
item 'Student name is ' || name ;
item 'Age: ' || put (age , 2. ) ;
item 'Sex: ' || trim(sex) ;
item 'Height: ' || put(height , 5.1 ) ;
end;
run;
ods html close ;
This is code works independent of the noproctitle option being set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I just learned about this. This could be useful in situations using data steps.
"LINE Method" from SAS® 9.4 ODS: Advanced Topics, 3e
SAS Communities / Programming - ODS Object