Sas 为不同行分配不同格式的过程报告
我有一张我想要的桌子。唯一的问题是,当我去分配格式时,它将所有值的格式都保留了下来。我有一行应该是总计,但我不确定如何仅在proc报告中删除此行的格式: 希望:合计行不显示小数,因为它们是计数,但表的其余部分保持相同的格式Sas 为不同行分配不同格式的过程报告,sas,proc-report,proc-format,Sas,Proc Report,Proc Format,我有一张我想要的桌子。唯一的问题是,当我去分配格式时,它将所有值的格式都保留了下来。我有一行应该是总计,但我不确定如何仅在proc报告中删除此行的格式: 希望:合计行不显示小数,因为它们是计数,但表的其余部分保持相同的格式 %let gray=CXBFBFBF; %let blue=CX13478C; %let purple=CXDEDDED; title j=c h=10pt f='Calibri' color=black "Table 1-Distribut
%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;
您必须显式格式化各个计算块中的数值。引用的数值将取决于
分析
统计数据,语法将是可变的.statistic
根据m_type='m_tot'
源代码,您的数据(未显示)似乎是某种形式的预先计算的聚合。在这种情况下,引用类似于percentage16_1.sum
(sum
是指定分组时数值变量的默认分析
)
例如:
总结一些SASHELP.CARS变量,并更改Fordmake的格式
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;
使用PROC REPORT无法在一个列中轻松混合格式/分析。使用PROC TABLATE,或转换您希望的PROC报告方式。我是否可以仅使用一种格式为该行指定一个附加调用定义函数?或者,我是否可以创建一种格式,因为未包含在总值行中的所有剩余值都小于100,因为它们的总和为100%?