BookmarkSubscribeRSS Feed
PeteLund
Obsidian | Level 7

When I submit this little program...

=======================================================

ods html5 body="test.html" path="c:\temp" style=styles.default;
proc odstext;
h1 "This is an H1 header";
run;
proc odstext;
h2 "This is an H2 header";
run;
proc print data=sashelp.class(obs=5);
run;
ods html5 close;

=======================================================

 

...the resulting HTML has multiple DIV tags around the output.  For example, around the H1 header:

 

<div style="padding-bottom: 8px; padding-top: 1px">
<div id="IDX" style="padding-bottom: 8px; padding-top: 1px">
<h1 class="heading1">This is an H1 header</h1>
</div>
</div>

 

Similar DIVs are around the H2 heading and the table.  The 8px padding above and below everything really messes up the spacing of the output.  I don't see anything in the template specifying 8px padding.  If I manually edit the HTML and either remove the DIVs or set the padding to 0, things are okay.  Is there a way to change what SAS puts out there?

2 REPLIES 2
Quentin
Super User

I tried but failed with:

ods html5 body="test.html" path="Q:\junk" style=styles.default;
proc odstext;
h1 "This is an H1 header" /style=[padding=3px];
run;
ods html5 close;


This adds padding to the h1  tag, but does not effect the div tag:

<div style="padding-bottom: 8px; padding-top: 1px">
<h1 class="heading1" style="padding: 3px">This is an H1 header</h1>
</div>
The Boston Area SAS Users Group is hosting free webinars!

Register now at https://www.basug.org/events.
ChrisNZ
Tourmaline | Level 20

SAS passes tags as-is when they open and close a string such as a title.

How about simply something like

title '<h1 style="padding: 3px">This is an H1 header</h1>';

proc odstext will add DIVs.

proc template might be able to change that, I don't know.

 

 

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1662 views
  • 1 like
  • 3 in conversation