Desktop productivity for business analysts and programmers

Proc report column headers spanning

Occasional Contributor
Posts: 6

Proc report column headers spanning

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,

Posts: 9,431

Re: Proc report column headers spanning

Posted in reply to jpoole412
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:
column name age sex ('Spanning' height weight);

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:
column (' ' name age sex) ('Spanning' height weight);

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

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation