BookmarkSubscribeRSS Feed
jshaik
Calcite | Level 5

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.

screenshot.png

1 REPLY 1
Cynthia_sas
SAS Super FREQ

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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2931 views
  • 0 likes
  • 2 in conversation