我正在尝试使用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需要一个长度变量。
line brkline $varying100. LENGTHVARIABLE;
要删除TOTAL行,将长度变量设置为0;