I did some more investigating, and I discovered that Proc Report is better suited to my needs. In fact, I can use Proc Report to generate the column totals before I even dump the output into Excel.
I also found that many people have trouble with Excel cell naming conventions (ie, A1, A2, etc) than absolute reference (RC[-1]).
So here is my updated syntax. It works, except that I need to move the 200x_COUNT total to the bottom of the 200x_PERCENTAGE column. That's what the "formula:RC[-5]" part is intended to do -- copy the cell from 5 columns over. But it's not working.
proc report data=UT.OT_UT_FREQ_MERGE spanrows;
title "PRCDR Proc Report";
COLUMN PRCDR_CD_SYS UT2005_COUNT UT2006_COUNT UT2007_COUNT UT2008_COUNT UT2009_COUNT
UT2010_COUNT UT2005_PERCENT UT2006_PERCENT UT2007_PERCENT UT2008_PERCENT
UT2009_PERCENT UT2010_PERCENT;
define PRCDR_CD_SYS / group;
define UT2005_COUNT / group DISPLAY ANALYSIS SUM;
define UT2006_COUNT / group DISPLAY ANALYSIS SUM;
define UT2007_COUNT / group DISPLAY ANALYSIS SUM;
define UT2008_COUNT / group DISPLAY ANALYSIS SUM;
define UT2009_COUNT / group DISPLAY ANALYSIS SUM;
define UT2010_COUNT / group DISPLAY ANALYSIS SUM;
define UT2005_PERCENT / group style(column)={tagattr='format:0.00%'};
define UT2006_PERCENT / group style(column)={tagattr='format:0.00%'};
define UT2007_PERCENT / group style(column)={tagattr='format:0.00%'};
define UT2008_PERCENT / group style(column)={tagattr='format:0.00%'};
define UT2009_PERCENT / group style(column)={tagattr='format:0.00%'};
define UT2010_PERCENT / group style(column)={tagattr='format:0.00%'};
compute after;
PRCDR_CD_SYS="Column N";
endcomp;
compute UT2005_PERCENT;
if upcase(_break_)='_RBREAK_' then do;
call define(_col_,"style","style={tagattr=""formula:RC[-5]""}");
end;
endcomp;
rbreak after / summarize;
RUN;
... View more