【发布时间】:2021-03-12 19:48:46
【问题描述】:
在我的 SAS 代码中,我正在尝试使用 SAS ODS 语句将表报告到 Word 文件中。而且我使用的是公司的标准样式。当作业运行时,我可以在输出窗口中看到 Proc 报告输出表的边框。但是这些在Word文件中消失了。请看下面的代码:
ods word file="&outfolder\Tabulations and graphs for ¤t_month. ¤t_year. report.docx" style=custom_style;
options orientation=landscape nodate nonumber center topmargin=0.1in bottommargin=0.15in rightmargin=0.2in leftmargin=0.2in papersize=letter;
ods escapechar="^";
ods graphics on/ outputfmt=png height = 6.75in;
%let footnote_style = ^S = {just=l font_size=7pt font_weight = light};
proc report data=out.sample nowd spanrows split="$" ;
/*There are multiple define statements here*/
run;
ods word close;
自定义样式列表很长,无法删除。
另外,如果我使用 ODS PDF,那么边框会出现在 PDF 中,但不知何故不会出现在 docx 文件中。
自定义样式代码:
proc template;
define style Styles.custom_styles;
style fonts/
'TitleFont2'=("Arial",12pt,bold)
'TitleFont'=("Arial",12pt,bold)
'headingFont'=("Arial",10pt,bold)
'docFont'=("Arial",10pt)
'footFont'=("Arial",8pt)
'StrongFont'=("Arial",14pt,bold)
'EmphasisFont'=("Arial",14pt,italic)
'FixedEmphasisFont'=("<monospace>, Courier, monospace",10pt,italic)
'FixedStrongFont'=("<monospace>, Courier, monospace",10pt,bold)
'FixedHeadingFont'=("<monospace>, Courier, monospace",10pt)
'BatchFixedFont'=("<monospace>, Courier, monospace",10pt)
'FixedFont'=("<monospace>, Courier, monospace",10pt)
'headingEmphasisFont'=("Arial",14pt,bold italic);
style GraphFonts/
'GraphDataFont'=("Arial",7pt)
'GraphValueFont'=("Arial",9pt)
'GraphLabel2Font'=("Arial",10pt)
'GraphLabelFont'=("Arial",10pt)
'GraphFootnoteFont'=("Arial",8pt)
'GraphTitleFont'=("Arial",12pt,bold)
'GraphTitle1Font'=("Arial",12pt,bold)
'GraphAnnoFont'=("Arial",8pt)
'GraphUnicodeFont'=("<MTsans-serif-unicode>",9pt);
style color_list "Colors used in the default style"/
'bgA'=cxffffff
'bgA1'=cx005293
'bgb1'=cxe05206
'fgA'=cxffffff
'fgB1'=cx000000
'grey'=cxCCCCCC
'fgD1'=cx005293
'blue1'=cx005293
'orange1'=cxe05206
'red1'=cxd52b1e
'green2'=cx007582
'grey2'=cx6f7c7d
'moss2'=cx476822
'yellow2'=cxf6a800
'black2'=cx31261d
'blue2'=cx009cde
'black'=cx000000;
style colors "Abstract colors used in the default style"/
'headerfg'=color_list('bgA')
'headerbg'=color_list('bgA1')
'tablebg'=cxcccccc
'headerfgemph'=color_list('bgA')
'headerbgemph'=color_list('bgA1')
'headerfgstrong'=color_list('bgA')
'headerbgstrong'=color_list('bgA1')
'datafgemph'=color_list('fgB1')
'databgemph'=color_list('bgA')
'datafgstrong'=color_list('fgB1')
'databgstrong'=color_list('bgA')
'datafg'=color_list('fgB1')
'databg'=color_list('bgA')
'batchfg'=color_list('blue1')
'batchbg'=color_list('bgA')
'tableborder'=color_list('fgD1')
'notefg'=color_list('fgB1')
'notebg'=color_list('bgA')
'bylinefg'=color_list('blue1')
'bylinebg'=color_list('bgA')
'captionfg'=color_list('fgB1')
'captionbg'=color_list('bgA')
'proctitlefg'=color_list('fgB1')
'proctitlebg'=color_list('bgA')
'titlefg'=color_list('fgB1')
'titlebg'=color_list('bgA')
'systitlefg'=color_list('fgB1')
'systitlebg'=color_list('bgA')
'contentfg'=color_list('fgB1')
'contentbg'=color_list('bgA')
'docfg'=color_list('fgB1')
'docbg'=color_list('bgA');
style graphcolors/
'gdata1'=color_list('blue1') 'gcdata1'=color_list('blue1')
'gdata2'=color_list('orange1') 'gcdata2'=color_list('orange1')
'gdata3'=color_list('red1') 'gcdata3'=color_list('red1')
'gdata4'=color_list('green2') 'gcdata4'=color_list('green2')
'gdata5'=color_list('grey2') 'gcdata5'=color_list('grey2')
'gdata6'=color_list('moss2') 'gcdata6'=color_list('moss2')
'gdata7'=color_list('yellow2') 'gcdata7'=color_list('yellow2')
'gdata8'=color_list('black2') 'gcdata8'=color_list('black2')
'gdata9'=color_list('blue2') 'gcdata9'=color_list('blue2')
'gcdata12'=cxF7AC4E 'gdata12'=cxF7AC4E
'gcdata11'=cxB38EF3 'gdata11'=cxB38EF3
'gcdata10'=cx47A82A 'gdata10'=cx47A82A
'gcmiss'=cx979797
'gmiss'=cxc3c3c2
'gablock'=colors('docbg')
'gblock'=colors('docbg')
'gcclipping'=cxDC531F
'gclipping'=cxE7774F
'gcstars'=cx000000
'gstars'=cxB9CFE7
'gcruntest'=cxBF4D4D
'gruntest'=cxCAE3FF
'gccontrollim'=cxBFC7D9
'gcontrollim'=cxE6F2FF
'gcerror'=cx000000
'gerror'=cxB9CFE7
'gcpredictlim'=cx003178
'gpredictlim'=cxB9CFE7
'gcpredict'=cx003178
'gpredict'=cx003178
'gcconfidence2'=cx003178
'gcconfidence'=cx003178
'gconfidence2'=cxB9CFE7
'gconfidence'=cxB9CFE7
'gcfit2'=cx003178
'gcfit'=cx003178
'gfit2'=cx003178
'gfit'=cx003178
'gcoutlier'=cx000000
'goutlier'=cxB9CFE7
'gcdata'=cx000000
'gdata'=cxB9CFE7
'ginsetheader'=colors('docbg')
'ginset'=cxFFFFFF
'greferencelines'=cx808080
'gheader'=colors('docbg')
'gconramp3cend'=cxFF0000
'gconramp3cneutral'=cxFF00FF
'gconramp3cstart'=cx0000FF
'gramp3cend'=cxDD6475
'gramp3cneutral'=cxFFFFFF
'gramp3cstart'=cx967CD0
'gconramp2cend'=cx99CCFF
'gconramp2cstart'=cxFFFFFF
'gramp2cend'=cx967CD0
'gramp2cstart'=cxFFFFFF
'gtext'=color_list('black')
'glabel'=color_list('black')
'gborderlines'=color_list('black')
'goutlines'=color_list('black')
'ggrid'=cxECECEC
'gaxis'=color_list('grey')
'gshadow'=cx000000
'glegend'=cxFFFFFF
'gfloor'=cxFFFFFF
'gwalls'=cxFFFFFF;
style StartUpFunction "Controls the StartUp Function. TAGATTR is only element used.";
style ShutDownFunction "Controls the Shut-Down Function. TAGATTR is only element used.";
style Container "Abstract. Controls all container oriented elements." /
font=Fonts('DocFont')
color=colors('docfg')
backgroundcolor=colors('docbg');
style Index from Container "Abstract. Controls Contents and Pages." /
color=colors('contentfg')
backgroundcolor=colors('contentbg');
style Document from Container "Abstract. Controls the various document bodies." /
doctype="<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 3.2 Final//EN"">"
contenttype="text/html"
protectspecialchars=auto;
style Output from Container "Abstract. Controls basic output forms." /
backgroundcolor=colors('tablebg')
rules=NONE
frame=BOX
cellpadding=7
borderspacing=1
bordercollapse=separate;
style HeadersAndFooters from Cell "Abstract. Controls table headers and footers." /
font=fonts('HeadingFont')
color=colors('headerfg')
backgroundcolor=colors('headerbg');
style Caption from HeadersAndFooters "Abstract. Controls caption field in proc tabulate." /
borderspacing=0
cellpadding=0
color=colors('captionfg')
backgroundcolor=colors('captionbg');
end;
run;
任何帮助将不胜感激如果有人可以帮助我找出哪些 ODS 样式控制 PROC REPORT 输出?所以我可以添加边框宽度或其他相关选项。 谢谢!
【问题讨论】:
-
显示
custom_style的定义。还要添加一些示例数据和报告步骤来演示问题。 -
我已经添加了 custom_style 代码。报告步骤的输出作为图像附加。这就是我在word文件中得到的。无边界。
-
“边界”是什么意思?你的意思是你期待页面上的可见线条?我在你的照片中没有看到任何边框。或者您是指不包含任何内容的页面边距?
-
我的意思是表格边框。在表格之外和单元格之间。
标签: sas