04-01-2013 03:06 PM
Both PROC REPORT and PROC TABULATE will allow "nested" groups, where the primary group value "spans" the secondary group value. However, that only takes care of the spanning. You also indicated that you wanted font rotation. The spanning that you get from PROC REPORT and PROC TABULATE do not automatically include the rotation that you show.
Whether you can do the rotation you want depends on whether Microsoft Excel has a style definition for font rotation in the XML specification for Spreadsheet Markup Language XML 2003.
The only "simple" thing you can do from the SAS side of things is to insert a line feed between each character in the primary group values. Whether you can rotate the font is a question for Tech Support. The only destination that I know that can rotate headers is the MSOFFICE2K_X destination, which creates HTML files that Excel knows how to open and render.
ods listing close;
proc sort data=sashelp.cars;
by make model;
where make in ("Volkswagen" "Volvo");
ods tagsets.excelxp file='c:\temp\spanrows.xml' style=sasweb;
proc tabulate data=sashelp.cars;
class make model;
classlev make model /
var mpg_city mpg_highway;
table make*model all,
mpg_city*(min mean max);
proc report data=sashelp.cars nowd spanrows;
column make model mpg_city,(min mean max);
define make / group
define model / group
ods _all_ close;