BookmarkSubscribeRSS Feed
jpoole412
Calcite | Level 5
I using tagsets.excelxp to output the result of a proc report to Excel. In this proc report I have 5 columns with a spanned header over the 2 right columns. When I output this to Excel the 3 left most column are spanned by a blank column header. I'd like to remove this column header and not have a spanned header over the 3 left-most columns. (i.e. in Excel the column headers take up 2 rows...first row is for spanned headers and the 2nd is for the regular column headers, I would like the 3 columns that do not have a spanned header to be a "merged" cell of the first two rows). I honestly have no idea where to even start to try and accomplish this.

Thanks for any possible help,

Jeff
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
PROC REPORT wants to have the same number of columns on every row -- so, if you have a spanned header above only 2 variables (in a list of 5, there will be empty cells above the other 3 variables). So, for example:
[pre]
column name age sex ('Spanning' height weight);
[/pre]

The string "Spanning" will be above the column headers for height and weight and there will be empty cells above the columns for name, age and sex. You might try this:
[pre]
column (' ' name age sex) ('Spanning' height weight);
[/pre]

...but I am not on a machine where I can test now and I don't remember whether you can have spaces span the headers for NAME, AGE and SEX -- I think you can, but it's an easy enough approach to test and see what happens.

Otherwise, it sounds like the BOX area in PROC TABULATE does more what you want, because by default, it spans (or looks like merged cells) above the row header area. Without seeing your REPORT code, I don't know whether you have a detail report or a summary report, so I can't say whether TABULATE is a viable alternative in this situation. Can you post some of the code that you've tried??? Perhaps using SASHELP.CLASS for illustration purposes.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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