SAS-格式处理报告总计百分比

问题描述 投票:0回答:1

我尝试使用ODS EXCEL用公式制作proc报告。我使用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

如何用百分比格式化总计。

Thx

excel sas ods
1个回答
0
投票

您拥有9.4的哪个版本?

REPORT代码确实正确计算了总计的%OK(按照tagattr指定的格式和公式):

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;

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.