Could somebody point out please what I am doing wrong...
I have program as below with all variables(test1-test4) numeric however still Compute condition doesn't seems to work.So my intention was basically based on comparison between Test1 and test4 variable set the color of the cell different ...
PROC REPORT DATA=BREACHES NOWD HEADLINE ;
column test1 test2 test3 test4;
define test1 /display ;
define test2 /display ;
define test3 /display ;
define test4 /display ;
COMPUTE test1;
IF test1 > test4 THEN DO;
CALL DEFINE(_COL_,'STYLE','STYLE={BACKGROUNDCOLOR=RED}');
END;
ENDCOMP;
What you are describing is traffic lighting, for which there are many documents out there on the subject:
http://www2.sas.com/proceedings/sugi31/142-31.pdf
Is result one from Google, and it shows how to do it.
PROC REPORT processes the columns in the report from left to right. When it processes TEST1 the value of TEST4 is unknown. Create an alias of TEST4 to create a dummy column to the left of TEST1. Refer to the alias instead of TEST4 in your COMPUTE block. Use the NOPRINT option on the dummy column to keep it from appearing in your report.
Check out the Compute Block Processing section in the PROC REPORT doc. Also there are many fine papers on PROC REPORT on http://support.sas.com.
Thanks Tim this worked....I even not had to define alias moving the variable in the column definition worked...
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.