繼ODS再次進化後,ODS PRINTER從8.2版本到目前的9.2版本,其報表輸出多了很多編修方式,Scott Huntley, Cary,則提出了一些輸出為PDF檔的方法
起初的ODS語法可以先參考ODS的應用與ODS的應用2
options nonumber nodate; ods escapechar = "^"; ods pdf file="example1.pdf"; title1 "^S={just=L }This title is blue and left justified"; title2 "^S={just=R }This title is red and right justified"; title3 "^S={just=C }This title is green and centered"; proc print data=sashelp.class(obs=1);run; ods _all_ close; |
escapechar = "^"是用來使^S={ }在TITLE中有作用的語法使得下方說明能夠有作用
而依照作者所說明,^S={ }可以埋入文字標題字串內,且是用來定義文字標題字串內各種形式的文字輸出,有點類思WORD中的文字編輯,而支援的語法有以下
ABSTRACT, ACTIVELINKCOLOR, ASIS, BACKGROUND, BACKGROUNDIMAGE, BODYSCROLLBAR, BODYSIZE, BORDERCOLOR, BORDERCOLORDARK, BORDERCOLORLIGHT, BORDERWIDTH, BOTTOMMARGIN, BULLET, CELLPADDING, CELLSPACING, CONTENTPOSITION, CONTENTSCROLLBAR, CONTENTSIZE, CONTRASTCOLOR, CSSSTYLE, CSSTEXT, DESCRIPTION, DROPSHADOW, ENDCOLOR, FILLRULEWIDTH, FLYOVER, FONT, FONT_FACE, FONT_SIZE, FONT_STYLE, FONT_WEIGHT, FONT_WIDTH, FOREGROUND, FRAME, FRAMEBORDER, FRAMEBORDERWIDTH, FRAMESPACING, GRADIENT_DIRECTION, HREFTARGET, HTMLCLASS, HTMLCONTENTTYPE, HTMLDOCTYPE, HTMLID, HTMLSTYLE, IMAGE, IMAGESTYLE, INDENT, JUST, LEFTMARGIN, LINESTYLE, LINETHICKNESS, LINKCOLOR, LISTENTRYANCHOR, LISTENTRYDBLSPACE, MARKERSIZE, MARKERSYMBOL, MINOR, NEUTRALCOLOR, NOBREAKSPACE, OFFSET, OUTPUTHEIGHT, OUTPUTWIDTH, OVERHANGFACTOR, PAGEBREAKHTML, POSTHTML, POSTIMAGE, POSTTEXT, PREHTML, PREIMAGE, PRETEXT, PROTECTSPECIALCHARS, RIGHTMARGIN, RULES, STARTCOLOR, TAGATTR, THRESHOLD, TICKDISPLAY, TOPMARGIN, TRANSPARENCY, URL, VISITEDLINKCOLOR, VJUST, WATERMARK
可能因SAS版本不同所以吾的^S={ }有稍微差異(9.2版本),不過對於標題的修改可以參照title的說明就可以修改了如下
title3 color=red "^S={just=C }This title is green and centered"; |
稍微整理後如下
options nonumber nodate; ods escapechar = "^" ods pdf file="example1.pdf"; title1 color=red "^S={just=l}This title" color=blue " is blue and left justified"; proc print data=sashelp.class; run; ods _all_ close; |
當然為了讓輸出更為多樣化,吾也適度修改了內容以達到報表的美觀
options nonumber nodate; ods escapechar = "^"; ods pdf file="example1.pdf" style=sasweb; title color=red "^S={just=l font_size=10}This is kingbee " color=blue " testing "; footnote color=blue "This is tesitng for PDF output" ; proc print data=sashelp.class; run; ods pdf text="測試用的資料"; ods _all_ close; |
而其中用到了style=sasweb,為ODS的輸出時報表的美觀
另外ods pdf text="";,是可以將想要寫入報表的文字敘述用的方法
沒有留言:
張貼留言