SAS - 用百分比格式化 proc 报告总计
SAS - Format proc report grand total with percent
我尝试使用 ODS EXCEL 的公式制作过程报告。我使用 SAS 9.4。
我已经编码了。
对于每个人,我想知道动作的数量和比率。
但是,我无法将百分比格式应用于总计。
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;
Results KO
如何用百分比格式化总计。
感谢
你有什么版本的 9.4?
此 REPORT
代码确实正确计算了总计的 %OK(根据 tagattr 指定的格式和公式):
data have;
length person ;
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;
我尝试使用 ODS EXCEL 的公式制作过程报告。我使用 SAS 9.4。
我已经编码了。 对于每个人,我想知道动作的数量和比率。 但是,我无法将百分比格式应用于总计。
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;
Results KO
如何用百分比格式化总计。
感谢
你有什么版本的 9.4?
此 REPORT
代码确实正确计算了总计的 %OK(根据 tagattr 指定的格式和公式):
data have;
length person ;
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;