Hi,
Can any one suggest how to merge cells in a column in ods excelxp.Below is a screenshot of something I am looking for.Thanks.
Hi:
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.
cynthia
ods listing close;
proc sort data=sashelp.cars;
by make model;
where make in ("Volkswagen" "Volvo");
run;
ods tagsets.excelxp file='c:\temp\spanrows.xml' style=sasweb;
proc tabulate data=sashelp.cars;
class make model;
classlev make model /
style=Header{vjust=m};
var mpg_city mpg_highway;
table make*model all,
mpg_city*(min mean max);
run;
proc report data=sashelp.cars nowd spanrows;
column make model mpg_city,(min mean max);
define make / group
style(column)=Header{vjust=m};
define model / group
style(column)=Header{vjust=m};
define mpg_city/analysis;
run;
ods _all_ close;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.