我需要在输出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;