The SAS Output Delivery System and reporting techniques

ODS HTML - same size tables with BY group processing

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

ODS HTML - same size tables with BY group processing

I'm creating HTML output via a stored process invoked through the STP Web Interface, code follows.  Since each BY group creates a separate HTML table, and the data in each HTML table determines the widths of its columns, each HTML table is a different size and the columns don't line up ( see image attached ).

 

How do I tell ODS to create either:

   1. consistent table / column widths across all BY groups

   2. one big table where the BY vars are still only output once at the top of each group

 

TIA

 

proc print data = cntl_trigger_results noobs label

                     style (header)             = {background=#D0D0D0 font=(tahoma) font_size=2 font_weight=bold}

                     style (obsheader)    = {background=#D0D0D0 font=(tahoma) font_size=2 font_weight=bold}

                     style (data)         = {background=white font=(tahoma) font_size=1}

                     style (obs)                = {background=white font=(tahoma) font_size=1 foreground=black}

                     ;

                     by trigger_nm descending sys_load_dt descending sys_load_tm;

                     id trigger_nm sys_load_dt sys_load_tm;

                    

                     var trigger_seq_no /style={just=C};;

                     var trigger_seq_rc /style={foreground=colour. just=L};

                     var trigger_seq_type;

                     var    trigger_seq_type_nm trigger_seq_results_txt; * sys_load_dt sys_load_tm;

 


html_output.png

Accepted Solutions
Solution
‎09-07-2016 11:41 AM
Super User
Posts: 11,343

Re: ODS HTML - same size tables with BY group processing

[ Edited ]

 

One of the style elements you can specify for a cell/column is CELLWIDTH if you want to specify specific widths or WIDTH option on proc statement may help but works best with specified formats as that option using format information.

 

Adding  cellwidth= 1.2in to one of the variable style overrides would set the width to 1.2 inches, other units may be used.

 

View solution in original post


All Replies
Solution
‎09-07-2016 11:41 AM
Super User
Posts: 11,343

Re: ODS HTML - same size tables with BY group processing

[ Edited ]

 

One of the style elements you can specify for a cell/column is CELLWIDTH if you want to specify specific widths or WIDTH option on proc statement may help but works best with specified formats as that option using format information.

 

Adding  cellwidth= 1.2in to one of the variable style overrides would set the width to 1.2 inches, other units may be used.

 

New Contributor
Posts: 4

Re: ODS HTML - same size tables with BY group processing

Thank you, that works after a fashion ( e.g. if values are longer than the alloted width columns still move around ).   

 

Seems to me that BY group processing really shouldn't create a separate HTML table ( with column headers each time as well ).  Perhaps I should look at PROC REPORT instead.

 

 

 

 

Super User
Posts: 11,343

Re: ODS HTML - same size tables with BY group processing

In the first programming class I took many years ago the instructor said: "You'll spend 90 percent of your time getting the data right and then spend the other 90 percent getting the output to look the way you want."

 

Good luck. At least HTML doesn't worry about Page size, which could be an issue with Proc Report and where to break tables across pages.

New Contributor
Posts: 4

Re: ODS HTML - same size tables with BY group processing

Better image file


html_output.png
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 358 views
  • 0 likes
  • 2 in conversation