本文鏈接:https://www.cnblogs.com/snoopy1866/p/15182862.html
使用PROC REPORT過程生成RTF文件過程中,可以直接嵌入RTF的語法實現更復雜的控制。例如,一般生成的TFL文件中的表格名稱都要求為標題級別,SAS自身的PROC REPORT無法實現這個目的,可通過RTF控制符來設定。
\outlinelevelN可以實現定義標題級別的文本,其中N代表級別。
例如以下代碼:
options nodate nonumber;
ods listing close;
ods rtf file = "E:\class.rtf" style = styles.threelines;
ods escapechar = "@";
title1 justify = left "方案編號: xxx" justify = right "TFL版本號:1.0";
title2 justify = left "方案名稱: xxx" justify = right "TFL版本日期:2021-08-24";
footnote justify = left "Public Information" justify = right "@{pageof}";
proc report data = resdat.class split = "^"
style(report)={pretext = "\outlinelevel1{標題}\par\pard" fontfamily = "Times New Roman, 等線" fontsize = 10.5pt
posttext = "\pard f(x)=x\super 2\nosupersub"
protectspecialchars = on asis = on just=center outputwidth = 100 % }
style(header)={protectspecialchars = on asis = on just = center}
style(column)={protectspecialchars = on asis = off just = center}
style(lines)={protectspecialchars = on asis = on just = center};
column NAME SEX AGE HEIGHT WEIGHT;
define NAME /display center "姓名";
define SEX /display center "性別";
define AGE /display center "年齡";
define HEIGHT /display center "身高";
define WEIGHT /display center "體重";
run;
ods rtf close;
ods listing;
類似常用的RTF控制符如下:
| RTF控制符 | 效果 |
|---|---|
| \outlinelevelN | 定義標題級別文本 |
| \tab | 制表符 |
| \~ | 空格 |
| \par | 換行 |
| \pard | 清除格式 |
| \super | 上標 |
| \sub | 下標 |
| \nosupersub | 取消上下標 |
| \b \b0 | 粗體(取消粗體) |
| \i \i0 | 斜體(取消斜體) |
| \ul \ul0 | 下划線(取消下划線) |
| \ql \qr \qc | 居左、居右、居中對齊 |
| \highlightN | 高亮 |
| \hightlight0 | 取消高亮 |
