lovexialulu 发表于 2017-11-6 11:19
那是两种方案,ord 是数值型变量(2,3行ord值应该是一样的)在proc report里面用
proc sql;
create table table_1 as
select sex
,mean(height) as m_h
,std(height) as std_h
,mean(weight) as m_w
,std(weight) as std_w
,mean(age) as m_a
,std(age) as std_a
from sashelp.class
group by sex
;
quit;
proc sql;
create table table_2 as
select
mean(height) as m_h
,std(height) as std_h
,mean(weight) as m_w
,std(weight) as std_w
,mean(age) as m_a
,std(age) as std_a
from sashelp.class
;
quit;
data table_3;
set table_1 table_2;
run;
data table_4(keep=sex height weight age);
set table_3;
height=cats(put(m_h,4.1),"±",put(std_h,3.1));
weight=cats(put(m_w,5.1),"±",put(std_w,4.1));
age=cats(put(m_a,4.1),"±",put(std_a,3.1));
if sex="男" then
sex="男性";
else if sex="女" then
sex="女性";
else if sex=" " then
sex="合计";
run;
proc template;
define style Styles.Threelines;
parent = Styles.Default;
replace fonts /
'TitleFont2' = ("Times New Roman",10pt)
'TitleFont' = ("Times New Roman",10pt)
'StrongFont' = ("Times New Roman",10pt)
'EmphasisFont' = ("Times New Roman",10pt)
'FixedEmphasisFont' = ("Times New Roman, Courier",10pt)
'FixedStrongFont' = ("Times New Roman, Courier",10pt)
'FixedHeadingFont' = ("Times New Roman, Courier",10pt)
'BatchFixedFont' = ("SAS Monospace, Times New Roman, Courier",10pt)
'FixedFont' = ("Times New Roman, Courier",10pt)
'headingEmphasisFont' = ("Times New Roman",10pt)
'headingFont' = ("Times New Roman",10pt)
'docFont' = ("Times New Roman",10pt);
STYLE SystemTitle /
FONT_FACE = " Times New Roman, Comic Sans MS, Helvetica, sans-serif"
FONT_SIZE = 10pt
FONT_WEIGHT = bold
FONT_STYLE = roman
FOREGROUND = black
BACKGROUND = none;
STYLE SystemFooter /
FONT_FACE = " Times New Roman, Comic Sans MS, Helvetica, sans-serif"
FONT_SIZE = 10pt
FONT_WEIGHT = bold
FONT_STYLE = italic
FOREGROUND = midnightblue
BACKGROUND = none;
STYLE Header /
FONT_FACE = "Times New Roman, Helvetica, sans-serif"
FONT_SIZE = 10pt
FONT_WEIGHT = medium
FONT_STYLE = roman
FOREGROUND = black
BACKGROUND = none;
STYLE RowHeader from header /
BACKGROUND = none;
STYLE Data /
FONT_FACE = "Times New Roman, Helvetica, sans-serif"
FONT_SIZE = 10pt
FONT_WEIGHT = medium
FONT_STYLE = roman
FOREGROUND = black
CELLWIDTH=120
textalign = center
BACKGROUND = none;
STYLE Table /
FOREGROUND = black
BACKGROUND = none
CELLSPACING = 0
CELLPADDING = 3
FRAME = HSIDES
RULES = groups;
STYLE Body /
FONT_FACE = "Times New Roman, Arial, Helvetica, sans-serif"
FONT_SIZE = 10pt
FONT_WEIGHT = medium
FONT_STYLE = roman
FOREGROUND = black
BACKGROUND = none;
STYLE SysTitleAndFooterContainer /
CELLSPACING=0;
end;
run;
ods listing close;
options nodate nonumber;
ods tagsets.rtf style=Threelines;
ods tagsets.rtf file = "C:\Users\Administrator\Desktop\table.rtf";
proc report data=table_4 nowindows headline headskip;
column sex age height weight;
define sex/display "";
define age/display "年龄(岁)";
define height/display "身高(英寸)";
define weight/display "体重(磅)";
title "不同性别学生的基本信息比较";
run;
ods tagsets.rtf close;
您能花一些时间在这个程序上改一下吗?就是在第二行与第三行之间加条线。谢谢。