本人经常用到SAS处理数据,输出的表格样式是系统默认的,所以笔者试着修改了表格模板,生成科学文章中的”三线表“。
/* 本段代码受益于SGUI 31上112-31 proc template: The basics。有兴趣可以读读*/
proc template;
define style Styles.Threelines;
parent = Styles.Default;
STYLE SystemTitle /
FONT_FACE = " Times New Roman, Comic Sans MS, Helvetica, sans-serif"
FONT_SIZE = 5
FONT_WEIGHT = bold
FONT_STYLE = roman
FOREGROUND = midnightblue
BACKGROUND = white;
STYLE SystemFooter /
FONT_FACE = " Times New Roman, Comic Sans MS, Helvetica, sans-serif"
FONT_SIZE = 2
FONT_WEIGHT = bold
FONT_STYLE = italic
FOREGROUND = midnightblue
BACKGROUND = white;
STYLE Header /
FONT_FACE = "Times New Roman, Helvetica, sans-serif"
FONT_SIZE = 4
FONT_WEIGHT = medium
FONT_STYLE = roman
FOREGROUND = midnightblue
BACKGROUND = white;
STYLE RowHeader from header /
BACKGROUND = white;
STYLE Data /
FONT_FACE = "Times New Roman, Helvetica, sans-serif"
FONT_SIZE = 2
FONT_WEIGHT = medium
FONT_STYLE = roman
FOREGROUND = black
BACKGROUND = white;
STYLE Table /
FOREGROUND = black
BACKGROUND = white
CELLSPACING = 0
CELLPADDING = 3
FRAME = HSIDES
RULES = groups;
STYLE Body /
FONT_FACE = "Times New Roman, Arial, Helvetica, sans-serif"
FONT_SIZE = 3
FONT_WEIGHT = medium
FONT_STYLE = roman
FOREGROUND = black
BACKGROUND = white;
STYLE SysTitleAndFooterContainer /
CELLSPACING=0;
end;
run;
--------------------------------------------------------------------------------
ods html file='E:\Doctor Degree\sasdata\mydata.html' style=Threelines;
title 'three';
footnote 'welcome to
www.agri520.cn';
proc tabulate data= sashelp.class ;
class sex;
var age height weight;
table sex, (age height weight) *mean;
run;
ods html close;