You might have noticed, that the id value is only in the first row (when a new id value starts), after that it is not visiable and therefor the id variable is empty. You need to put the value of the first row for each id value aside and use this in the compute block. To put the value aside, use a COMPUTE BEFORE columnName compute block. See the example below. I use the _dummy variable to display the contents of the idkeep variable.
proc report data=sample nowd;
column id value1 value2 _dummy;
define id / 'ID' display order order=data;
define value1 / sum 'Value 1';
define value2 / sum 'Value 2';
define _dummy / computed;
compute before id;
idkeep = id;
endcomp;
compute _dummy;
_dummy = idkeep;
if idkeep = 1 and value1.sum > value2.sum then do;
call define("value1.sum", "style", "style={background=Red}");
end;
endcomp;
run;
... View more