0

我有一张按我想要的方式布置的表格。唯一的问题是,当我去分配格式时,它继承了所有值的格式。我有一行应该是总计的,但我不确定如何仅在 proc 报告中去除该行的格式:

输出

希望:总行不显示小数,因为它们是计数的,但表格的其余部分保持相同的格式。

    %let gray=CXBFBFBF;
    %let blue=CX13478C;
    %let purple=CXDEDDED;
    title j=c h=10pt f='Calibri' color=black "Table 1-Distribution, CY2016-CY2018";
        options orientation = landscape nonumber nodate leftmargin=0.05in rightmargin=0.05in;
        ods noproctitle noresults escapechar='^';
        ods rtf  file = "path.rtf";
         proc report data= work.temp nowd spanrows  style(report)={width=100%}
            style(header)=[vjust=b font_face = Calibri fontsize=9pt font_weight=bold background=&blue. foreground=white borderrightcolor=black];
            /*List variables in order to select order of columns in table*/
        col ( m_type 
                  ('^S={borderbottomcolor=&blue. vjust=b borderbottomwidth=0.02 }'('^S={borderbottomcolor=&blue. vjust=b borderbottomwidth=0.01 cellheight=0.20in}Age in Years' d_char_desc)) 
                  ('^S={cellheight=0.20in}Missing Information' 
                  ('^S={borderbottomcolor=&blue. borderbottomwidth=0.02 cellheight=0.18in}' percentage16_1)
                  ('^S={borderbottomcolor=&blue. borderbottomwidth=0.02 cellheight=0.18in}' percentage17_1)
                  ('^S={borderbottomcolor=&blue. borderbottomwidth=0.02 cellheight=0.18in}' percentage18_1))
);
define m_type /order=data group noprint style = [vjust=b just=left cellwidth=0.60in font_face='Times New Roman' fontsize=9pt];

        define d_char_desc / order=data display  style = [vjust=b just=left cellwidth=0.60in font_face='Times New Roman' fontsize=9pt]
                         '' style(header)=[vjust=b just=left cellheight=0.18in] style(column)=[vjust=b just=left cellheight=0.35in cellwidth=0.60in];
        define percentage16_1  /display style = [vjust=b just=center  cellwidth=0.60in cellheight=0.05in font_face='Times New Roman' fontsize=9pt] 
                         'CY2016' style(header)=[vjust=b just=center cellheight=0.18in] style(column)=[vjust=b just=center cellheight=0.20in cellwidth=0.40in];
        define percentage17_1 /display style = [vjust=b just=center  cellwidth=0.45in cellheight=0.05in font_face='Times New Roman' fontsize=9pt] 
                         'CY2017' style(header)=[vjust=b just=center cellheight=0.18in] style(column)=[vjust=b just=center cellheight=0.20in cellwidth=0.40in];
        define percentage18_1  /display style = [vjust=b just=center  cellwidth=0.45in cellheight=0.05in font_face='Times New Roman' fontsize=9pt] 
                         'CY2018' style(header)=[vjust=b just=center cellheight=0.18in] style(column)=[vjust=b just=center cellheight=0.20in cellwidth=0.40in];
compute m_type;    
if m_type = 'm_tot' then
call define (_row_, 'style', 'style=[fontweight=bold background=&gray. font_face=Times]');
endcomp;
run;
ods rtf close;
4

1 回答 1

0

您必须明确格式化各个计算块中的数值。引用的数值取决于analysis统计数据,语法为variable.statistic

m_type = 'm_tot'根据源代码,您的数据(未显示)似乎是某种形式的预先计算的聚合。在这种情况下,引用将类似于percentage16_1.sum(指定分组时数字变量sum的默认值)analysis

例子:

总结一些 SASHELP.CARS 变量并更改福特品牌的格式。

proc report data=sashelp.cars;
  column ( 
    make

    horsepower mpg_city mpg_highway 

    horsepower_custom
    mpg_city_custom
    mpg_highway_custom
  );

  define make / group ;*noprint;

  define horsepower  / analysis noprint mean ;  
  define mpg_city    / analysis noprint mean ;  
  define mpg_highway / analysis noprint mean ;  

  define horsepower_custom / computed style=[textalign=right];
  define mpg_city_custom / computed style=[textalign=right];
  define mpg_highway_custom / computed style=[textalign=right];

  compute horsepower_custom / character length=10;
    if make = 'Ford' 
      then horsepower_custom = put (horsepower.mean, 10.4);
      else horsepower_custom = put (horsepower.mean, 8.1);
  endcomp;

  compute mpg_city_custom / character length=10;
    if make = 'Ford' 
      then mpg_city_custom = put (mpg_city.mean, 10.5);
      else mpg_city_custom = put (mpg_city.mean,  8.2);
  endcomp;

  compute mpg_highway_custom / character length=10;
    if make = 'Ford' 
      then mpg_highway_custom = put (mpg_highway.mean, 10.6);
      else mpg_highway_custom = put (mpg_highway.mean,  8.3);
  endcomp;
run;

在此处输入图像描述

于 2019-11-09T03:18:54.097 回答