I am having trouble with a background color not populating in the second table of my HTML output. Please see the code below.
ods tagsets.tableeditor file="&path\&&xst1.SASHELP..html"
options(
frozen_headers="yes"
frozen_rowheaders="yes"
banner_color_even="beige"
banner_color_odd="white"
header_bgcolor="teal"
header_fgcolor="white"
rowheader_bgcolor="lightblue"
gridline_color="gray"
header_size="12"
rowheader_size="12"
data_size="11"
);
PROC TABULATE NOSEPS MISSING FORMAT=comma7. FORMCHAR=' ' data=sashelp.cars;
CLASS make;
class type drivetrain / style={background=lightyellow};
/*Make Table*/
tables all*(n f=5.1*pctn<make all>)
(type all)*(pctn<type all>)*f=5.1
(drivetrain all)*(pctn<drivetrain all>)*f=5.1,
all make / nocellmerge rts=16 misstext='--' box=_page_ printmiss;
keylabel all='Total' n='No.' pctn='%';
run;
/*Origin Table*/
PROC TABULATE NOSEPS MISSING FORMAT=comma7. FORMCHAR=' ' data=sashelp.cars;
CLASS origin;
class type drivetrain / style={background=lightyellow};
tables all*(n f=5.1*pctn<origin all>)
(type all)*(pctn<type all>)*f=5.1
(drivetrain all)*(pctn<drivetrain all>)*f=5.1,
all origin /nocellmerge rts=16 misstext='--' box=_page_ printmiss;
keylabel all='Total' n='No.' pctn='%';
run;
ods tagsets.tableeditor close;
This produces the following tables. You can see in the 2nd table that the row headers "Type" and "DriveTrain" are blue rather than light yellow as the style option specifies.
However, the light yellow background color does show up when viewing the SAS output table.
If you want the levels of the class variable such as Hybrid SUV and such to have the style element then try adding:
classlev type drivetrain / style={background=lightyellow};
Classlev controls the appearance of value levels, Class controls appearance behavior of the variable heading.
I don't have tagsets.tableeditor installed so I can't duplicate the issue.
I would be tempted to remove the tagset option
rowheader_bgcolor="lightblue"
and see if that helps. Possibly that might require adding additional style elements to get other things to be the color you want.
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.