SAS tagsets.excelxp条件格式

我正在使用tagsets.excelxp和proc报告来生成一个报告,倾销到Excel。 我试图得到列中的最小值,并在列中的最大值分别在我的输出中突出显示红色和绿色。

例如:

OBS Rate 1 5% 2 10% 3 15% 

在我的Excel输出中,我希望5%被突出显示为红色,15%被突出显示为绿色。

我试图在一个proc报告中使用一个计算块,但不能得到它的工作。

在这里你有一个如何解决这个问题的例子。 proc report之前必须创buildmacrosvariables,它存储有关最小值和最大值的信息。 之后,您需要使用compute块并call definedynamic格式化call define

 ods tagsets.ExcelXP file="C:\temp\res.xml"; proc sql noprint; select max(age), min(age) into :max, :min from sashelp.class; quit; proc report data=sashelp.class; column Name Age; compute Age; if Age.sum = &max. then call define(_row_, 'style', 'style={background=red}'); else if Age.sum = &min. then call define(_row_, 'style', 'style={background=green}'); endcomp; run; ods tagsets.ExcelXP close;