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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2950 views
  • 0 likes
  • 2 in conversation