[PROC REPORT] 使用RTF控制符

本文链接: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 取消高亮
posted @ 2021-08-24 22:31  Snoopy1866  阅读(1851)  评论(0编辑  收藏  举报