BookmarkSubscribeRSS Feed
Erin
Calcite | Level 5

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.

compute new;

     if difference = 'New Record' then call DEFINE(_row_, "style", "STYLE=[BACKGROUND=#99ccff]"); *This line successfully colors entire row;

endcomp;

compute sae;

     if (difference eq 'source') then call DEFINE('source', "style", "STYLE=[BACKGROUND=#99ccff]"); *This line is not producing errors, but is not working;

endcomp;

Thanks so much in advance!  Any insight is greatly appreciated!

1 REPLY 1
Cynthia_sas
SAS Super FREQ


Hi:

  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:

compute age;

   if height gt 60 then do;

      **** some code;

  end;

endcomp;

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???

cynthia

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 885 views
  • 0 likes
  • 2 in conversation