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;
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.
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.
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.
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.
Better image file
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 25. 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.