标题: ODS TIPS:如何在报告中根据值的不同动态填色 [打印本页] 作者: shiyiming 时间: 2003-11-13 12:45 标题: ODS TIPS:如何在报告中根据值的不同动态填色 这段程序可以根据不同数据的MIN,MEAN,MAX进行动态填色,比前面给出的那段要聪明一点
/*Create dataset to play with; */
data ddt;
input x y;
cards;
1 25
2 30
3 40
4 50
5 55
7 60
6 90
;
/*Create format for the colors; */
proc means data=ddt;
var y;
output out=outddt;
run;
data _null_;
set outddt;
if _stat_='MIN' then call symput('MIN1',y);
if _stat_='MEAN' then call symput('MEAN1',y);
if _stat_='MAX' then call symput('MAX1',y);
run;
proc format;
value tlight low-&min1='Blue'
&min1-&mean1='Yellow'
&mean1-<&max1='Green'
&max1-high='Red';
run;
/*Create the report and direct it to html using ODS; */
filename new 'c:\cooltable.html';
ods listing close;
ods html body=new;
proc report data=ddt nowd headline;
column X Y;
define X / display 'x-label' style(column)=[foreground=black background=white];
define Y / analysis 'y-label' style(column)=[foreground=white background=tlight.];
run;
goptions DEVICE=ActiveX transparency hsize=7in vsize=4in cback=H0C2E166
xpixels=750 ypixels=350 colors=(red yellow blue purple orange green black white grey);
ods html file=_webout attributes=("codebase"="/SASGraph_New.exe") style=sasweb;
proc print data=tempnor label noobs;
var mean std max min;
title1 color=black box=1 blank=yes bcolor=CXE0E1D9 color=cx3169A5 font=宋体 justify=left "工艺实绩";
title2 " 各类统计值";
label mean=平均数 std=方差 max=最大值 min=最小值;
run;
ods html close;