hi,
perhaps it's a stupid question, but I'm new to SAS and did not find a solution for that:
How can I tell PROC REPORT to produce a html output with a given table-id, header-id and body-id? Or a given class?
I only found information about giving a cell a html-id.
I'm looking for a parameter for PROC REPORT like ID=ABC or CLASS=XYZ and result should be
<table class="xyz" id="table_ABC" summary="Procedure Report: Detailed and/or summarized report">
<thead id="thead_ABC">
...
<tbody id="tbody_ABC">
...
thank you very much in advance
If you sort your data according to (i.e., BY) some variable or set of variables (e.g., sex if using sashelp.class), and use the same by statement in your proc report, then you can use the #byvall parameter (e.g., title1 "Gender = #byvall"'
HTH,
Art, CEO, AnalystFinder.com
Perhaps a bit fragile and requiring a good understanding of the target destination but the RAW function in conjunction with Escapechar allows you to specify raw code for a destination. You would likely need to create what I think you are asking for in a break statement with BEFORE or AFTER as needed in a Style option.
thank you for your answers. I came up with a client-side solution by setting the html-id by javascript after document creation.
But I will keep your advices in mind for similar tasks in the future.
Hi, there are some options you can work with HTMLCLASS=, HTMLID=, and HTMLSTYLE=, as described here: https://support.sas.com/rnd/base/ods/templateFAQ/Template_csstyle.html#htmlclass and
http://support.sas.com/documentation/cdl/en/odsadvug/69833/HTML/default/viewer.htm#p0xi2cygmfk0wkn1e...
and here's an example of using HTMLCLASS, HTMLID and ANCHOR=
cynthia
Please send me your solution for adding Id= in the THEAD and the TBODY
I need exactly the same idea,
Thanks very much for your help
Ilan
Thanks very much for your immediate answer,
I have already noticed your answer from 02-06-2017 and I realized the answer for the table
but I need to add Id="name" to the specific tags <thead> and also for <tbody> .
Look forward to hear from you and best regards.
Hi:
When I look up that track, 7612193400, I see that that subject was listed as (highlights are mine):
How to freeze table headers in HTML5 for IE11 by using SAS 9.3 ODS
I did not get from your original post that using ID= was needed to freeze table headers, or that you were interested in HTML5 or that you only had SAS 9.3. Based on your original posting it seemed you wanted to use PROC REPORT to add ID= to <thead> and <tbody> elements of the HTML page, based on this question from the post:
"How can I tell PROC REPORT to produce a html output with a given table-id, header-id and body-id? Or a given class?"
I do not have SAS 9.3 to experiment with. And, as I remember, HTML5 was first available in SAS 9.4, so I'm not sure about how you're going to generate HTML5 in SAS 9.3. Also, since HTML5 is a Lua-based destination, that means there is NOT a tagset template to modify, so my previous answer would have been possible (to modify the tagset template) IF you were using HTML4, but not correct, if you are asking about HTML5.
My suggestions were to either use a DATA step program or to modify a tagset template for HTML4.Neither of my suggestions were related to PROC REPORT and unfortunately, neither of my suggestions were at all related to freezing table headers or making the table body scroll. When I look at the w3schools.com site on CSS, it looks like they explain scrolling with CSS and the overflow: property. It also looks like they add the overflow property to a <div> tag, not a <thead> or <tbody> tag.
Even if I did come up with an example to add ID= to <thead> and <tbody> tags, it would not be in HTML5, I would only be able to try in HTML4. And since HTML5 is a Lua destination, any HTML4 example would not do you any good. So there's not any utility in something that will not work in the version of SAS that you have or produce what you ultimately say you want.
I've never worked with scrolling tables in HTML much, so I'm out of suggestions.
Cynthia
Hi:
I only have SAS 9.4M5 to test with. I don't know whether this will work in 9.3 or not. Here's what I came up with for adding an ID= to <thead> and <tbody> output using a TAGSET template.
This same approach will NOT work for HTML5 for the reasons previously noted.
I hope this gets you closer to your goal. The syntax for TAGSET templates (or Markup destination templates) is an event driven syntax. I touched on TAGSET templates briefly in this paper: https://support.sas.com/resources/papers/proceedings09/227-2009.pdf .
If you have more questions about TAGSET templates, you'll have to work with Tech Support as your best resource.
Cynthia
Use the procedure option STYLE(<location>)=[tagattr='ID="MY_ID"'] to set a TABLE ID.
- Proc PRINT use STYLE(table)
- Proc REPORT use STYLE(report)
Example:
ods html file='class.html';
proc print data=sashelp.class style (table) = [tagattr='id="MyId"'];
proc report data=sashelp.class style (report) = [tagattr='id="MyId#2"'];
run;
ods html close;
Will produce html source containing
<table class="table" id="MyId" cellspacing="0" cellpadding="5" rules="all" frame="box" bordercolor="#C1C1C1"
summary="Procedure Print: Data Set SASHELP.CLASS">
/pre>
and
<table class="table" id="MyId#2" cellspacing="0" cellpadding="5" rules="all" frame="box" bordercolor="#C1C1C1"
summary="Procedure Report: Detailed and/or summarized report">
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: