Hello,
I would like to color a cell of a table using PROC REPORT, but using a variable that is different from the variable that is in the cell. The problem is reproduceable from this following simple program, and described in greater detail following the simple program.
Sample program:
data test;
input a b c;
cards;
1 2 3
1 2 4
1 2 4
2 4 5
2 4 1
2 4 6
;
proc print;
var a b c;
run;
proc report data=test nowindows headline headskip;
columns a b c ;
define a / display ' Level ' width =6;
define b / display ' Home ' width =6;
define c / display ' color' width = 6;
compute b;
if b > 3 then call define(_col_,"style","style={background = red");
endcompute;
*compute a;
* if c > 4 then call define(_col_,"style","style={background = green");
* endcompute;
compute a;
if _c3_ > 4 then call define(_col_,"style","style={background = green");
endcompute;
run;
In the above program, the first compute statement colors the Home column cells red for those cells where the Home column is greater than 3. This works fine.
However, I would really like to color the cells of Level green, based on the values of the color column.
The second compute statement (that is commented out) does the obvious, which does not work.
The third compute statement uses the _Cn_ approach to identifying the column to create the color values. No error or warnings are produced, but the colored cells do not appear on the table.
The resulting table should have two cells in the Level column colored green. The 4th and 6th cell.
Note that the reason wanting to do this is not clear from the test data, but makes sense in the table I am creating.
Any thoughts from would be greatly appreciated. (Note I could not find anything on this in my searching of the archives).
Sincerely,
Dan
... View more