The following code produces HTML wherein the specified headtext gets truncated to 256 characters.
Q: Does any know how to increase the allowed headtext or otherwise inject such?
SAS program specifying a head text of 320 characters
options lrecl=32000; * does nothing for me regarding headtext! ; ods html path='.' file = 'sample.html' style=plateau headtext= '<!--5678901234567890123456789012345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890123456789012345678901234567890 12345678901234567890123456789012345678901234567890123456789012345678901234567-->' ; proc print data=sashelp.class; run; ods html close;
HTML output source with headtext truncated to 256 characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <!--567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 <meta name="Generator" content="SAS Software Version 9.4, see www.sas.com">
From the documentation for ODS HTML ( I added some emphasis). I don't know if that a general HTML limit or SAS ODS limit.
specifies markup tags to place between the < HEAD> and < /HEAD> tags in all of the output files.
specifies the markup tags to place between the < HEAD> and < /HEAD> tags.
| Restriction | HEADTEXT= cannot exceed 256 characters. |
| Requirement | You must enclose markup-document-head in quotation marks. |
| Tips | ODS cannot parse the markup that you supply. It should be well-formed markup that is correct in the context of the <HEAD> and </HEAD> tags. |
| Use the HEADTEXT= option to define programs (such as JavaScript) that you can use later in the file. |
From the documentation for ODS HTML ( I added some emphasis). I don't know if that a general HTML limit or SAS ODS limit.
specifies markup tags to place between the < HEAD> and < /HEAD> tags in all of the output files.
specifies the markup tags to place between the < HEAD> and < /HEAD> tags.
| Restriction | HEADTEXT= cannot exceed 256 characters. |
| Requirement | You must enclose markup-document-head in quotation marks. |
| Tips | ODS cannot parse the markup that you supply. It should be well-formed markup that is correct in the context of the <HEAD> and </HEAD> tags. |
| Use the HEADTEXT= option to define programs (such as JavaScript) that you can use later in the file. |
The > 256 character was for including a number of external javascript libraries.
I was able to get around the issue by placing some of the <script> tags at the bottom of the html
Example:
filename htmlout "great-page.html"; ods html body=htmlout (NO_BOTTOM_MATTER) style=plateau headtext='<link rel="stylesheet" href="https://cdn.datatables.net/1.11.0/css/jquery.dataTables.min.css">' ; * tagattr is IMPORTANT; proc print data=sashelp.class style(table)=[tagattr='id="MyTable1"']; run; ods html close;
* stuff that would not fit in html HEADTEXT limit of 256 characters; data _null_; file htmlout MOD; put '<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>' / '<script src="https://cdn.datatables.net/1.11.0/js/jquery.dataTables.min.js"></script>' / '<script>' / '$(document).ready(function(){' / ' debugger;' / ' $("#MyTable1").DataTable({paging: false});' / '})' / '</script>' ; put '</body>' ; run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.