Hi Everyone,
Can you help me with this color code?
it works if I want to color '_c2_'.
Thank you,
HHCFX
data a;
input name $ v1 v2 v3;
datalines;
a 1 2 1
a 3 4 1
b 4 5 3
b 3 5 8
b 1 1 5
c 1 1 5
c 0 0 5
run;
proc report data=a nowd;
define name/display;
define v1/display;
define v2/display;
define v3/display;
compute v1 ;
if v1>2 then call define('_c3_',"style","style={background=BIYG}");
else
call define('_c3_',"style","style={background=LIGY}");
endcomp;
run;
proc report data=a nowd;
column name v1 v2 v3;
define name/display;
define v1/display;
define v2/display;
define v3/display;
compute v3 ;
if v1>2 and 3<v2<=5 then call define(_col_,"style","style={background=BIYG}");
else
if v1>=1 and v2 <4 then call define(_col_,"style","style={background=LIGY}");
endcomp;
run;
SOLUTION
compute v3 ; if v1>2 then call define(_col_,"style","style=[background=grey]"); else call define(_col_,"style","style=[background=lightpink]"); endcomp;
You can reference a different variable in your logic. I think this works for what you want.
compute v3 ; if v1>2 then call define(_col_,"style","style=[background=grey]"); else call define(_col_,"style","style=[background=lightpink]"); endcomp;
You can reference a different variable in your logic. I think this works for what you want.
Your code run.
proc report data=a nowd;
column name v1 v2 v3;
define name/display;
define v1/display;
define v2/display;
define v3/display;
compute v3 ;
if v1>2 and 3<v2<=5 then call define(_col_,"style","style={background=BIYG}");
else
if v1>=1 and v2 <4 then call define(_col_,"style","style={background=LIGY}");
endcomp;
run;
Yes. Thank you.
My bad.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.