sas - 在 proc 报告中仅获取特定的组换行符
问题描述
我正在尝试使用 proc 格式格式化我的表格,但无法弄清楚如何仅为我的数据中的特定组指定换行符。
有
想
这是目前我的数据的结构方式:
这是我一直试图弄清楚的代码......
title "Table 1";
options orientation = landscape nonumber nodate leftmargin=0.05in rightmargin=0.05in;
ods noproctitle noresults escapechar='^';
ods rtf file = "path";
proc report data= work.appendix_a1 nowd spanrows
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_type1
('^S={borderbottomcolor=&blue. vjust=b borderbottomwidth=0.02 }Table'('^S={borderbottomcolor=&blue. vjust=b borderbottomwidth=0.02 }Characteristics' m_char_desc))
('^S={cellheight=0.20in}CY 2016'
('^S={borderbottomcolor=&blue. borderbottomwidth=0.02 cellheight=0.18in}' count_16)
('^S={borderbottomcolor=&blue. borderbottomwidth=0.02 cellheight=0.18in}' percentage_16))
('^S={cellheight=0.20in}CY2017'
('^S={borderbottomcolor=&blue. borderbottomwidth=0.02 cellheight=0.18in}' count_17)
('^S={borderbottomcolor=&blue. borderbottomwidth=0.02 cellheight=0.18in}' percentage_17))
('^S={cellheight=0.20in}CY2018'
('^S={borderbottomcolor=&blue. borderbottomwidth=0.02 cellheight=0.18in}' count_18)
('^S={borderbottomcolor=&blue. borderbottomwidth=0.02 cellheight=0.18in}' percentage_18)));
define m_type1 /order=data group noprint;
define m_char_desc / order=data display style = [vjust=m just=center cellwidth=0.90in font_face='Times New Roman' fontsize=8pt]
'' style(header)=[vjust=t just=left cellheight=0.05in] ;
define count_16 /display style = [vjust=m just=center cellwidth=0.45in cellheight=0.05in font_face='Times New Roman' fontsize=9pt]
'n' style(header)=[vjust=t just=center cellheight=0.18in];
define percentage_16 /display style = [vjust=m just=center cellwidth=0.45in cellheight=0.05in font_face='Times New Roman' fontsize=9pt]
'%' style(header)=[vjust=t just=center cellheight=0.18in];
define count_17 /display style = [vjust=m just=center cellwidth=0.45in cellheight=0.05in font_face='Times New Roman' fontsize=9pt]
'n' style(header)=[vjust=t just=center cellheight=0.18in];
define percentage_17 /display style = [vjust=m just=center cellwidth=0.45in cellheight=0.05in font_face='Times New Roman' fontsize=9pt]
'%' style(header)=[vjust=t just=center cellheight=0.18in];
define count_18 /display style = [vjust=m just=center cellwidth=0.45in cellheight=0.05in font_face='Times New Roman' fontsize=9pt]
'n' style(header)=[vjust=t just=center cellheight=0.18in];
define percentage_18 /display style = [vjust=m just=center cellwidth=0.45in cellheight=0.05in font_face='Times New Roman' fontsize=9pt]
'%' style(header)=[vjust=t just=center cellheight=0.18in];
compute before m_type1/
style=Header{just=l fontweight=bold fontsize=8pt};
length brkline $100;
brkline = catx('',m_type1);
line brkline $varying100.;
endcomp;
run;
ods rtf close;
解决方案
这会修改另一个答案以使用 $VARYING 格式产生所需的结果。
关于该主题的 SAS 使用说明:http: //support.sas.com/kb/37/763.html
proc report data=sashelp.cars;
where type = 'Sedan' and drivetrain = 'All' and msrp < 30000;
title "All wheel Sedans under $30K";
columns origin make model msrp;
define origin / order noprint;
compute before origin
/ style = [
fontweight=bold
background=lightgray
textalign=left
cellpadding=111pt
]
;
length linetext $200.;
linetext = origin;
if origin='Asia' then l=0;
else l=length(linetext);
line linetext $varying200. l;
endcomp;
compute origin;
if not missing(origin) then
hold_origin = origin;
if hold_origin = 'Asia' then
call define (_row_, 'style', 'style=[fontweight=bold background=VLIG fontstyle=italic]');
endcomp;
run;
推荐阅读
- c# - DatePicker 列的 WPF DataGridCellInfo 项属性值
- c# - 有没有办法将控制台的光标左侧位置设置为最小值?
- android - 如何在 Android 的图库中保存和显示图像
- c - printf 正在产生异常的响应
- python - 有没有一种有效的方法将字符串拆分为带有 numba 的列表?
- gcc - 如何在启动时自动运行两个 gdb 命令
- winapi - MFC:有没有办法将 CMFCShellTreeCtrl 限制为特定的根文件夹?
- python-3.x - 合并两个数据框列时从 dtype='datetime64[ns]' 更改为 dtype: object,如何避免?
- rest - 公开 grpc 以获取 rest api
- c++ - `obj.operator+=(rhs)` 与 `obj += rhs`