Hi all,
I need to put a matrix on a pdf, and need to color some cells of the diagonal of it, and I'm wondering if there is an easy way, without the need to count all the columns and make lot of pre-computations.
A the end, I have a proc report like this
proc report data=MATRIX_TABLE missin;
columns REGION_A VALUE,REGION_B;
define REGION_A / group;
define REGION_B / across '';
define VALUE / analysis;
run;
and need to higlight (background color/text/etc) only the cells that have equal values for REGION_A/B (not always present).
Any idea I'm missing?
Thanks!
Yes, there are a lot of ways to color backgrounds of cells in PROC REPORT, and I'm sure Google will find so many you can't read them all.
Coloring the background of diagonal cells is something I have not done, and seems to me you might need a macro to determine the exact list of levels of REGION_A and REGION_B and then find out when you are in the (1,1) cell and the (2,2) cell and so on, and run this macro in the COMPUTE block of PROC REPORT. If (additional complication) the list of values of REGION_A and REGION_B changes from one run of PROC REPORT on data set1 to the next run of PROC REPORT on data set 2, then you will definitely need a macro.
Hi:
With some fake data that represented an "even" matrix of 4 values for the rows and 4 values for the columns, I was able to use of PROC REPORT with a temporary variable to do the highlighting on the diagonal, as shown below:
Note that this method will only work with an "even" matrix. If Region_A had 4 values, but Region_B had 5 values, then the logic of the COMPUTE block would not work.
But, then, there's no really a diagonal to highlight for the EEE value, so I would assume that's OK.
Cynthia
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!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.