BookmarkSubscribeRSS Feed
defaz
Fluorite | Level 6

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

 

 

 

13 REPLIES 13
art297
Opal | Level 21

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

 

ballardw
Super User

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.

defaz
Fluorite | Level 6

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.

 

Cynthia_sas
SAS Super FREQ

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=

use_HTMLCLASS_HTMLID.png

 


cynthia

arbel
Calcite | Level 5

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

Cynthia_sas
SAS Super FREQ
Hi:
Not sure I understand what you mean. I posted the code in the screen shot in the posting from 02-06-2017.
Cynthia
arbel
Calcite | Level 5

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.

Cynthia_sas
SAS Super FREQ
Hi:
I do not believe you can change the thead or tbody attributes from within a style override, such as I show for PROC REPORT.

The only ways I can think of to do this would be to post-process the HTML file with a DATA step program to modify thead and tbody tags and add the ID= attribute or to alter one of the HTML tagset templates to provide an ID= for the tags.

Since many of the markup destinations have been written in LUA, I'm not sure whether it is possible to modify the HTML tagset template to add ID=. So that is a question for Tech Support about whether it is possible.

Cynthia
arbel
Calcite | Level 5
Hi,
post-process the HTML file with a DATA step program means that I have to repeat it for about
50,000 reports in Web Portal for the same reason,
The Bank I work with is going to kill me,
if I can not do that in SAS ODS style It is a lot more
correct to do it with Vbscript.
That is why I've asked the guy that knows how,
to send me his solution, and I'm steel waiting for him....
Surely I preferred to do it with SAS ODS but it seems that you have no solution for the this purpose.
The main reason for this problem is to find a way
to freeze header titles in html report in IE11
and not with Comatible mode or using JQUERY
which is impossible in our internet Zone.
I think I have the way of getting it for IE11
in HTML4 / HTML5 without any additions,
I'm steel struggling with it since July 2017
Please look at my open case: SAS no. 7612193400. (I haven't received an answer.. yet.)
Thanks very much for your answer I need Help
Ilan
Cynthia_sas
SAS Super FREQ

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

 

 

arbel
Calcite | Level 5
Hi Cinthia,
I really appreciate your detailed answer,
all my efforts are to create massive Html reports with Html. and actually it's not important if Html4 or Html5 for this purpose as long as it works !!!!
I am using now the old evaluation relative vbscript commands such as Z-index in Compatible mode to achieve this purpose and it's working, and it is similar to the solution advised by SAS Support, however this works only in when defined with compatibility to IE7 in the web portal (and also inside the Html report).
I am looking for a better solution to replace this temporary way by using HTML5 or new advanced Vbscript tools, and I think I finally approach to this point after struggling with it for more then a year,
I also searched for soulutions in the Internet, but it seems that the only way found so far is to use Jquery and Js.files (this way is a problem in our Bank site.)
I have created my own solution in vb but it requires id="" as I have mentioned earlier to you. I thought it is possible to handle it with SAS Proc Template. I still have a way to replace it with vbscript and I hope to reach this target shortly.
It's really frustrating and surprising that this critical fact of fixed header title in tables in IE11 is not supported by Microsoft any more and no user solution found in SAS Communities for it. (as in Excel Environment)
Thanks very much for your help and concern.
Best Wishes,
Ilan
Cynthia_sas
SAS Super FREQ

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.

tagset_add_ID_attr.png

 

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

RichardDeVen
Barite | Level 11

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">

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 13 replies
  • 3504 views
  • 0 likes
  • 6 in conversation