05-17-2012 10:23 AM
In trying to change the background of specific cellsin proc report, I have created the following code. There are not any errors in the log, yet it is not highlighting the particular cells appropriately. Could this be related to my specified options? Difference is a variable I created that identifies discrepencies by the variable name.
if difference = 'New Record' then call DEFINE(_row_, "style", "STYLE=[BACKGROUND=#99ccff]"); *This line successfully colors entire row;
if (difference eq 'source') then call DEFINE('source', "style", "STYLE=[BACKGROUND=#99ccff]"); *This line is not producing errors, but is not working;
Thanks so much in advance! Any insight is greatly appreciated!
05-17-2012 11:10 AM
This is a question where seeing all your PROC REPORT code would be most useful. The things that I suspect, but can't verify because you didn't post all your code are:
1) the order of variables in your COLUMN statement are wrong, somehow for the test you are making, then the highlighting will not work. PROC REPORT works from left to right in the COLUMN statement. So if I have this, for example:
COLUMN name age sex height weight;
then in the compute block for AGE, I cannot have a test based on HEIGHT because at the point in time when PROC REPORT places AGE on the report and executes the COMPUTE block for AGE, it has not yet placed the column information for HEIGHT. So based on the above column statement, this would be wrong:
if height gt 60 then do;
**** some code;
PROC REPORT does not have a PDV like the DATA step program, so you can only ask REPORT to test what has been placed on the report based on the COLUMN statement.
2) Something wrong with the case or values for DIFFERENCE. You said that you created DIFFERENCE, but you didn't say whether you had created it outside of PROC REPORT or in a REPORT COMPUTE block. Again, the left to right order of things could be coming into play here, such as might occur if you have DIFFERENCE at the end of your COLUMN statement, but you are testing it in one of the values that occur before DIFFERENCE. But the values you created might be the wrong case or spelled wrong for the test to work.
3) You have the second test for DIFFERENCE in the COMPUTE block for SAE, but you are changing the SOURCE column...why is this test happening in the COMPUTE block for the SAE item???