Hi:
What you want really can't be done with PROC REPORT. Once you have a header that spans ALL the columns, (like the middle header for Spanning 2 that is shown below) with PROC REPORT, the only thing that can go above it is another header that spans the entire row, like the header for Spanning 1 -- this header cannot be "split" into 2 columns with PROC REPORT:
However, it can be done for HTML and PDF in the Report Writing Interface (RWI), as shown here:
The code that produced the screen shot is here:
ods html(id=sp) file="c:\temp\diff_span.html";
title '1) Detail Report';
data _null_;
set SASHELP.class end=last;
if _N_ = 1 then do;
dcl odsout obj();
obj.table_start();
obj.head_start();
** Header row 1;
obj.row_start(type:"Header");
obj.format_cell(text: "A", column_span:3, style_attr:"fontweight=bold");
obj.format_cell(text: "B", column_span:2,style_attr:"fontweight=bold");
obj.row_end();
** Header row 2;
obj.row_start(type:"Header");
obj.format_cell(text: "Spanning All 5 Columns", column_span:5,style_attr:"background=lightyellow");
obj.row_end();
** Header row 3;
obj.row_start(type: "Header");
obj.format_cell(text: "Name", style_attr:"fontweight=bold");
obj.format_cell(text: "Age", style_attr:"fontweight=bold");
obj.format_cell(text: "Sex", style_attr:"fontweight=bold");
obj.format_cell(text: "Height", style_attr:"fontweight=bold");
obj.format_cell(text: "Weight", style_attr:"fontweight=bold");
obj.row_end();
obj.head_end();
end;
** row for every obs;
obj.row_start();
obj.format_cell(data: name );
obj.format_cell(data: age);
obj.format_cell(data: sex);
obj.format_cell(data: height);
obj.format_cell(data: weight);
obj.row_end();
if last then do;
obj.table_end();
end;
run;
ods html(id=sp) close;
Hope this helps,
cynthia
... View more