Hi: Dynamic labeling, as you call it, of the column headers underneath a nesting is not possible with PROC TABULATE. Your only option would be to create an HTML file and then post process the HTML tags and change the text to be what you want. Or, to create an output dataset and then pass summarized variables to another procedure, such as PROC REPORT. BTW options like LINESIZE and PAGESIZE and RTS are ignored by ODS destinations because they are LISTING only options. Here is some code to test that uses 2 PROC REPORTs to do what you want. The first one creates a dataset, the second one has the names you want. This could easily be "macroized"; or you could post process the HTML file. The only issue is that if you wanted PDF output, then the PROC REPORT approach would be the better approach, since you can't really "post process" the PDF file. Increased the number of decimal places on the format so you could see the rounding differences between a picture format and a SAS defined format. (If you do not understand the _c2_ _c3_, etc, then my suggestion is that you read up on how PROC REPORT handles ACROSS variables.) Cynthia options nodate; data fundrais; length name $ 8 classrm $ 1; input @1 team $ @8 classrm $ @10 name $ @19 pencils @23 tablets; sales=pencils + tablets; datalines; BLUE A ANN 4 8 RED A MARY 5 10 GREEN A JOHN 6 4 RED A BOB 2 3 BLUE B FRED 6 8 GREEN B LOUISE 12 2 BLUE B ANNETTE . 9 RED B HENRY 8 10 GREEN A ANDREW 3 5 RED A SAMUEL 12 10 BLUE A LINDA 7 12 GREEN A SARA 4 . BLUE B MARTIN 9 13 RED B MATTHEW 7 6 GREEN B BETH 15 10 RED B LAURA 4 3 ; run; proc format; picture pctfmt low-high='009.99 %'; run; ods html file='c:\temp\rename_across_headers_with_report.html'; proc tabulate data=fundrais format=9.; title '1) TABULATE'; class team classrm; var sales; table (team all), classrm='Classroom'*sales=' '*(sum colpctsum*f=pctfmt.) all*sales*sum=' '; run; proc report data=fundrais nowd out=repout(where=(team gt ' ')); title '2) First Report Example Summarizes Data and Calcs Percents'; column team classrm,(sales salesp) sales=total; define team / group; define classrm / across; define sales / sum; define salesp / computed f=percent9.2; define total / sum 'All'; compute before; totc2 = _c2_; totc4 = _c4_; endcomp; compute salesp; _c3_ = _c2_ / totc2; _c5_ = _c4_ / totc4; endcomp; rbreak after / summarize; compute after; team = 'All'; endcomp; run; proc print data=repout ; title '3) Data Set From Proc Report (percent not multiplied by 100)'; run; proc report data=repout nowd; title '4) Final PROC REPORT -- use SAS Percent format'; where team gt ' '; column team ('Classroom' ('A' _c2_ _c3_) ('B' _c4_ _c5_)) Total; define team / order order=data style(column)=Header; define _c2_ / display 'A Sum'; define _c3_ / display 'A ColPctSum' f=percent9.2; define _c4_ / display 'B Sum'; define _c5_ / display 'B ColPctSum' f=percent9.2; define total / 'All'; run; ods html close;
... View more