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?
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>
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.
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.
Ready to level-up your skills? Choose your own adventure.