1

我希望你能帮忙。我想减少 SAS 在图表底部和脚注之间添加的空白量。我正在将图表生成为 .pdf 文件,这些文件需要满足某些要求,即具有最小边距(我在选项声明中指定)以及左对齐的标题和脚注。随着越来越多的标题和页脚被添加,似乎空白的数量不成比例地增加了。我还想延长图形的左右长度。我曾尝试在 ods 图形语句中使用宽度和高度选项以及许多其他内容。
下面使用 sashelp.esno 编写代码。任何见解表示赞赏。

options nodate nonumber pageno=1 pagesize=43 linesize=108 orientation=landscape papersize=LETTER LEFTMARGIN=0.87in RIGHTMARGIN=0.87in TOPMARGIN=1.25in BOTTOMMARGIN=1.25in;

/*Note: US letter measures 8.5 by 11.0 inches (215.9 by 279.4 mm). */
ods graphics off;
run;
ods _all_ close;
ods graphics  on / reset=all width=9in height=4.9in border=off;
ods PDF file="C:\Users\YourNameHere\Documents\ElNino.PDF" nogtitle nogfootnote bookmarkgen=NO;
title1 j=l height=10pt "Report number" ;
title2 j=l height=10pt "Figure number" ;
title3 height=10pt "El Nino Southern Oscillation";
title4 height=10pt "Observation station X";
footnote1  height=10pt "footnote1: it is the space above here that I would like to reduce" ;
footnote2 j=L height=10pt "footnote 2 width=9in height=4.9in";

proc sgplot data=sashelp.enso;
    series x = month y= pressure;
    refline 10 / axis = y label = "10" lineattrs=(color=red);
run;

ods graphics off;
run;
ods _all_ close;

更新:Richard 分享的 SAS 知识库文章包含一个有用的解决方法。http://support.sas.com/kb/55/923.html。这是改编后的代码:

ods graphics off;
run;
ods _all_ close;
options nodate nonumber pageno=1 pagesize=43 linesize=108 orientation=landscape papersize=LETTER LEFTMARGIN=0.87in RIGHTMARGIN=0.87in TOPMARGIN=1.25in BOTTOMMARGIN=1.25in;
ods pdf file="C:\Users\YourNameHere\Documents\ElNino2.PDF" nogfootnote nogtitle notoc;

title1 j=l height=10pt "Report number" ;
title2 j=l height=10pt "Figure number" ;
title3 height=10pt "El Nino Southern Oscillation";
title4 height=10pt "Observation station X";
footnote1  height=10pt "footnote1: The space above here is now much reduced" ;
footnote2 j=L height=10pt "footnote 2 some more details here";

/* Insert a blank row with TEXT= and eliminate the page
    break this statement generates by setting STARTPAGE=NO. */
ods pdf text=" " startpage=no;
ods graphics on / reset border=off height=4in width=7in;

proc sgplot data=sashelp.enso;
    series x = month y= pressure;
    refline 10 / axis = y label = "10" lineattrs=(color=red);
run;


/* If more pages follow, uncomment the folllowing code to   */
/* reset the STARTPAGE= option to its default value of YES. */
/*ods pdf startpage=yes;*/

ods pdf close;
ods graphics off;
run;
ods _all_ close;
4

1 回答 1

0

这是一个已知问题:

问题说明 55923:ODS GRAPHICS 语句 HEIGHT= 或 WIDTH= 值可能在 ODS PDF 目标输出中被忽略

于 2018-01-19T20:36:14.947 回答