I try to make a proc report with formula with ODS EXCEL. I use SAS 9.4.
I have coded this. For each person, I would like to have the number of actions and a ratio. But, I can't apply percent format to the grand Total.
proc report data=_TEMP.STATS(where=( compress(tranwrd(LIB_BUR,"'",''))="&f_equ.")) headline headskip;
column PERSO_ID nb_err nb_ok tx_maj;
define PERSO_ID / GROUP 'Conseiller';
define nb_err / SUM 'Nb Maj non effectuées';
define nb_ok / SUM 'Nb Maj effectuées';
define tx_maj / computed display 'Tx maj effectuées' format=percent4.2
style(column)={tagattr="format:0.00% formula:RC[-1]/(RC[-1]+RC[-2])"};
rbreak after /summarize style=[BACKGROUND=cxECEDEC];
quit;
How can I format the Total with percent.
Thx
What release of 9.4 do you have?
This REPORT
code does correctly compute the %OK of the totals (per the tagattr specified format and formula):
data have;
length person $20;
input person error_count ok_count; datalines;
BOSSUVE 9 12
BRALAU 13 160
DURIEUJE 1 52
MARECAUU 39 116
run;
ods excel file='C:\Temp\demo.xlsx';
proc report data=have;
columns person error_count ok_count ok_pct;
define ok_pct / computed 'Ok %'
width = 21
style(column) = {
width = 1.5cm
tagattr = "
format:0.00%
formula:RC[-1]/(RC[-1]+RC[-2])
"
}
;
compute after;
person = 'Total';
endcomp;
rbreak after / summarize;
run;
ods excel close;