SAS ODS RTF 中的縮進

????????臨床統(tǒng)計分析中的報表經(jīng)常以如下的樣式出現(xiàn),如果生成這樣的表格,可能有很多種方法?,F(xiàn)在說一種本人工作中用的方法。

測試數(shù)據(jù)集就用SASHELP.class.

proc sort data=sashelp.class out=a;by sex name;run;

先定義輸出的RTF模板,定義如下(ps,模板如果沒定義好,出報告中的某些代碼可能不會起作用,具體是哪方面原因還沒弄明白)。

proc template;

define style tfl_table;

style body/

leftmargin = 0.5in

rightmargin = 0.5in

topmargin = 1in

bottommargin = 1in;

style table /

frame = hsides

rules = groups

cellpadding = 3pt

cellspacing = 0pt

width = 100%;

style header /

fontfamily = 'Courier New'

asis = off

fontsize = 9pt;

style data /

fontfamily = 'Courier New'

fontsize = 9pt

asis = on;

style TableFooterContainer /

borderbottomcolor = white;

style TitlesAndFooters /

fontfamily = 'Courier New'

textalign = left

fontsize = 10pt;

style systemfooter /

textalign = left

fontfamily = 'Courier New'

fontsize = 9pt;

style NoteContent from Note /

textalign = left

fontsize = 9pt

fontfamily = 'Courier New'

asis = on;

end;

run;

用PROC REPORT 過程步輸出RTF的代碼如下:

options orientation=portrait nodate nonumber;

ods escapechar='^';

ods rtf file = "d:\test.rtf" style=tfl_table;

footnote "^{super a} : This is done by kongyy";

proc report nowindows data=a;

column sex name ("Sex" header) ("^R'\brdrb\brdrs\brdrw2 'Wonder Treatment" weight height);

define sex /order noprint;

define name /noprint;

define header /'' computed;

define weight / display 'weight' format=8.1 style={just=r};

define height / display 'height' format=8.1 style={just=r};

break before sex /summarize ;

compute header / character length = 20;

if _break_ = 'Sex' then header = Sex;

else header = "^{nbspace 3}"||name;

endcomp;

run;

ods rtf close;

假如要使weight 和 height中的數(shù)值小數(shù)點位對齊的話,則可使用style來定義。代碼如下:

define weight / display 'weight' format=8.1 style={pretext="^R'\tqdec\tx350 '" just=r};

define height / display 'height' format=8.1 style={pretext="^R'\tqdec\tx350 '" just=r};

除了以上方法產(chǎn)生縮進RTF外,還可以用^w產(chǎn)生空格的效果, ^ 這個為自定義的ods escapechar.

compute header / character length = 20;

if _break_ = 'Sex' then header = Sex;

else header = "^w^w^w^w"||name;

endcomp;


好了,以上就是我想分享的,更多的輸出格式控制技巧,以后有空再探索。謝謝。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 字體屬性:(font) 大小 {font-size: x-large;}(特大) xx-small;(極小) 一般...
    書寫人生吖閱讀 462評論 0 0
  • 字體屬性:(font) 大小 {font-size: x-large;}(特大) xx-small;(極小) 一般...
    可愛傻妞是我的愛閱讀 341評論 0 0
  • CSS樣式被稱為為“層疊樣式表”,是一種網(wǎng)頁制作做不可或缺的技術(shù),是用于裝飾網(wǎng)頁,達到設(shè)計效果的一種樣式語言,下面...
    唐紅_f455閱讀 477評論 0 1
  • 去掉下劃線: text-decoration:none; 占四分之一的距離: width:25% 居中對齊:tex...
    writeanewworld閱讀 454評論 0 0
  • 久違的晴天,家長會。 家長大會開好到教室時,離放學(xué)已經(jīng)沒多少時間了。班主任說已經(jīng)安排了三個家長分享經(jīng)驗。 放學(xué)鈴聲...
    飄雪兒5閱讀 7,865評論 16 22

友情鏈接更多精彩內(nèi)容