TABULATE Procedure

Example 16: NOCELLMERGE Option

Features:

PROC TABULATE statement options: STYLE=

CLASS statement

TABLE statement:
crossing (*) operator
STYLE= option
NOCELLMERGE= option
Other features:

ODS HTML statement

Details

This example does the following:
  • creates a table with merged cells style behavior
  • creates a second table without merged cells
  • shows how cells styles are affected when empty data cells and the formatted data cells use different styles

Program

ods html file="tabstyle.html";
proc tabulate data=sashelp.class style={background=red};
class sex age;
   
table sex*{style={background=blue}} all, age;
title 'Data Cell Styles in Merged Cells';
run;
   
proc tabulate data=sashelp.class style={background=red};
class sex age;
   
table sex*{style={background=blue}} all, age/nocellmerge;
title1 'Data Cell Styles with NOCELLMERGE Option';
run;
   
ODS HTML close;
   

Program Description

Specify the ODS output filename.The ODS HTML statement produces output that is written in HTML.
ods html file="tabstyle.html";
Specify the PROC TABULATE options.The STYLE= option sets the background color for the cells in the table to red.
proc tabulate data=sashelp.class style={background=red};
Specify subgroups.The CLASS statement separates the data by sex and age.
class sex age;
   
Define the table rows and columns.The TABLE statement creates a table. The STYLE= option in the dimension expression overrides the STYLE= setting from the PROC TABULATE statement for table cells attributes.
table sex*{style={background=blue}} all, age;
Specify the title of the table to be produced.This table shows how changing the style color affects the merged cells.
title 'Data Cell Styles in Merged Cells';
Run the program.
run;
   
Specify the PROC TABULATE options.The STYLE= option sets the background color for the cells in the table to red.
proc tabulate data=sashelp.class style={background=red};
Specify subgroups.The CLASS statement separates the data by sex and age.
class sex age;
   
Define the table rows and columns.The TABLE statement creates a table. The STYLE= option in the dimension expression overrides the STYLE= setting from the PROC TABULATE statement, but only for the formatted data cells..
table sex*{style={background=blue}} all, age/nocellmerge;
Specify the title of the table to be produced.This table shows how changing the style color affects the formatted cells that re not merged.
title1 'Data Cell Styles with NOCELLMERGE Option';
Run the program.
run;
   
Close the ODS HTML output destination.
ODS HTML close;
   

Output

NOCELLMERGE Option