proc tabulate data=sasuser.admit; class sex; var height weight; table sex, height*mean height*sum weight*mean weight*sum / box = {style = {background = CYAN}}; *左上角的cell; keyword mean sum /style={background=cxCCEEDD}; *关键字; run; ods listing close; ods html path='E:sas' file='colortable.html'; proc format; value $actlevfmt "HIGH"="H" "MOD"="M" "LOW"="L"; value $albac "HIGH"="cxBBDDCC" "MOD"="cxAABBCC" "LOW"="cx99BBAA"; value max 70-high="red" other=ywh; value meanflyo low-65='LOW traffic. Cut flights?' 70-high='HIGH traffic. Add flights?'; value $sexgif 'F'='<DIV>F<P><IMG SRC="男.gif"></DIV>' 'M'='<DIV>M<P><IMG SRC="女.gif"></DIV>'; run; title2 '<FONT face="serif" color="brown"> 不同水平下身高体重</FONT>'; proc tabulate data=sasuser.admit format=4.1 style={background=ywh font_style=italic}; /*修改数据格子的颜色*/ var height /style = {background=cxCCEEDD}; Var weight / style= <parent>; *同act level的水平颜色; class sex actlevel / style = {background = cyan}; *这两个变量名出现的地方; table sex*actlevel*(height*(mean*{style={flyover=meanflyo.}} max*{style={background=max.}}) weight*{style=<parent>}) / box = {style = {background = papk}}; keyword mean / style = {background = papk}; keyword sum / style = <parent>{foreground=black}; classlev actlevel / style = {background = $albac.}; *变量对应水平的地方,可以用format给每个水平添加一个颜色; format actlevel $actlevfmt. sex $sexgif.; /*引用format记得加$和period*/ ods html close; ods listing; ods listing close; ods html path='e:sas' body='laguard.html'; title1 'LaGuardia Flights by Destination'; title2 'and Revenue, March 4-10'; proc format; value $desname 'CPH'='<DIV>Copenhagen<P><IMG src="denmark.gif"></DIV>' 'FRA'='<DIV>Frankfurt<P><IMG src="germany.gif"></DIV>' 'LON'='<DIV>London<P><IMG src="uk.gif"></DIV>' 'PAR'='<DIV>Paris<P><IMG src="france.gif"></DIV>'; value $desback 'CPH'='cxBBDDCC' 'FRA'='cxAACCBB' 'LON'='cx99BBAA' 'PAR'='cx88AA99'; value deplback low-105='lipk' 245-250='vpapb' other='ywh'; value deplflyo low-105='LOW traffic. Cut flights?' 245-250='HIGH traffic. Add flights?' other=' '; run; proc tabulate data=sasuser.laguardia format=comma9. style={background=ywh}; class dest / style={background=cxCCEEDD font_style=italic}; classlev dest / style={background=$desback.}; var boarded transferred deplaned / style={background=cxCCEEDD}; var revenue / style=<parent>{foreground=black}; table dest*(boarded transferred deplaned*{style={background=deplback. flyover=deplflyo.}} revenue*{style=<parent>}),min max mean sum / box={style={background=cxCCEEDD}}; keyword min max mean sum / style={background=cxCCEEDD font_style=italic}; label dest='Destination'; format dest $desname.; run; ods html close; ods listing;
。