SAS在图表底部和脚注之间添加空白区域

时间:2018-01-19 17:21:22

标签: sas sas-ods

我希望你能提供帮助。我想减少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;