我需要在具有双外边框和实心内边框的输出 RTF 文件(保存为 Word .docx 文件)中格式化表格,如下所示:
这可能与PROC REPORT
使用某种STYLE
或COMPUTE
语句有关吗?我尝试过创建 CSS 模板,但遇到了语言问题。
DATA TEST;
INPUT CAR $12. YEAR;
DATALINES;
CHEVY 2001
FORD 2005
HONDA 2008
;
RUN;
ODS RTF FILE= "C:\Users\Documents\SAS Example Code\Test.rtf" STYLE=STATISTICAL;
PROC REPORT DATA = TEST NOWD;
COLUMN CAR YEAR;
DEFINE CAR / DISPLAY "Car";
DEFINE YEAR / DISPLAY "Year";
COMPUTE;
/* insert code here to produce double outside border, solid inside border? */
ENDCOMP;
RUN;
ODS RTF CLOSE;
或者,如果我要使用代码创建自定义 SAS 样式,我该如何实现呢?
PROC TEMPLATE;
DEFINE STYLE STYLES.DOUBLEBORDER;
PARENT = STYLES.RTF;
STYLE USERTEXT FROM USERTEXT /
TEXTALIGN = LEFT
FONTSTYLE = ROMAN
FONTSIZE = 3.5;
STYLE FONTS /
'DOCFONT' = ("<SANS-SERIF>, <MTSANS-SERIF>, ARIAL",2)
'HEADINGFONT' = ("<SANS-SERIF>, <MTSANS-SERIF>, ARIAL",2,BOLD)
'HEADINGEMPHASISFONT' = ("<SANS-SERIF>, <MTSANS-SERIF>, ARIAL",2,BOLD)
'FIXEDEMPHASISFONT' = ("<MONOSPACE>, COURIER, MONOSPACE",2)
'FIXEDSTRONGFONT' = ("<MONOSPACE>, COURIER, MONOSPACE",2,BOLD)
'FIXEDHEADINGFONT' = ("<MONOSPACE>, COURIER, MONOSPACE",2)
'BATCHFIXEDFONT' = ("SAS MONOSPACE, <MONOSPACE>, COURIER, MONOSPACE",2)
'FIXEDFONT' = ("<MONOSPACE>, COURIER",2)
'EMPHASISFONT' = ("<SANS-SERIF>, <MTSANS-SERIF>, ARIAL",2)
'STRONGFONT' = ("<SANS-SERIF>, <MTSANS-SERIF>, ARIAL",2,BOLD)
'TITLEFONT' = ("<SANS-SERIF>, <MTSANS-SERIF>, ARIAL",3,BOLD)
'TITLEFONT2' = ("<SANS-SERIF>, <MTSANS-SERIF>, ARIAL",2,BOLD);
STYLE DATA /
VERTICALALIGN = CENTER
TEXTALIGN = CENTER
FONTSIZE = 10PT
FONTFAMILY = "ARIAL";
STYLE TABLE /
FRAME = BOX
BORDERWIDTH = 1
VERTICALALIGN = CENTER
TEXTALIGN = CENTER
FONTSIZE = 10
CELLPADDING = 1.4
BORDERSPACING = 0.7;
STYLE HEADER /
VERTICALALIGN = CENTER
TEXTALIGN = CENTER
FONTWEIGHT = BOLD
FONTSIZE = 10PT
FONTFAMILY = "ARIAL";
STYLE ROWHEADER /
VERTICALALIGN = CENTER
TEXTALIGN = CENTER
FONTSIZE = 10
FONTFAMILY = "ARIAL";
STYLE FOOTER /
VERTICALALIGN = CENTER
TEXTALIGN = CENTER
FONTSIZE = 10
FONTFAMILY = "ARIAL";
STYLE COLOR_LIST /
'LINK' = BLUE
'BGH' = WHITE
'FG' = BLACK
'BG' = WHITE;
STYLE BODY FROM DOCUMENT /
MARGINBOTTOM = 1IN
MARGINTOP = 1IN
MARGINRIGHT = 1IN
MARGINLEFT = 1IN;
END;