Hello,
Basically I'm trying to color column cell using value of other column.
I would like to have all values of COL2 displayed colored where COL1='A'.
However, with following code only first value of COL2 where COL1='A' is being displayed colored.
Please suggest!!
Thanks!!
data test1;
input COL1 $1. COL2 $5. NUM1;
datalines;
A rx1 2
A rx2 1
B rx1 1
B rx2 2
B rx2 5
B rx3 3
run;
ods pdf file="C:\test.pdf" notoc /*style=mystyle*/ uniform;
proc report data=test1 nofs nocenter headline headskip split="/" /*spanrows*/;
column col1 col2 num1;
define col1 / group;
define col2 / group;
define num1 / analysis sum;
compute col2;
if col1='A' then
call define(_col_, "style", "STYLE=[BACKGROUND=cxFFFF82]");
endcomp;
run;
ods pdf close;
You need to "remember" the value of col1.
You need to "remember" the value of col1.
Excellnt, this works!
Thanks!!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.