There is servral issues.
One, you can not use a variable in proc report in compute befroe it is defined in a column. So ALERT needs to be after VAR6. You can fix this with a alias of alert.
Another issue, is the since you group by var1, var2 and var3, alert is also grouped. You can se this if you output the proc report data.
This works, but i gues it is not what you want.
PROC REPORT DATA=TEST2 SPANROWS out=test;
COLUMNS VAR1 VAR2 VAR3 ALERT=ARLET_ALIAS ('' VAR7), (VAR6 ) ALERT;
DEFINE VAR1 / GROUP CENTER ORDER=DATA;
DEFINE VAR2 / GROUP;
DEFINE VAR3 / GROUP;
DEFINE ALERT / NOPRINT ;
DEFINE VAR6 / ACROSS;
DEFINE VAR7 / ACROSS;
COMPUTE VAR6;
IF ARLET_ALIAS=1 THEN DO;
CALL DEFINE (_col_,"style","style={background=lightred}"); END;
ELSE IF ARLET_ALIAS=9 THEN DO;
CALL DEFINE (_col_,"style","style={background=lightorange}"); END;
ELSE IF ARLET_ALIAS= 10 THEN DO;
CALL DEFINE (_col_,"style","style={background=lightgreen}"); END;
ELSE IF ARLET_ALIAS=8 THEN DO;
CALL DEFINE (_col_,"style","style={background=lightblue}"); END;
ENDCOMP;
RUN;
... View more