Hi Guys,
here i am using prdsale data set. I am trying to color the quarter column on basis of their number. Ex 1=pink 2=yellow 3=green 4=red.
below is my code but it is not working.
proc report data=sashelp.prdsale;
column product quarter;
/*define quarter/ group;*/
COMPUTE quarter;
IF quarter >3
THEN CALL DEFINE(_col_, "style", "STYLE=[BACKGROUND=RED]");
ENDCOMP;
run;
Hi:
You can also accomplish what you want to do with a format, no CALL DEFINE needed.
Cynthia
proc format;
value qfmt 1='pink'
2='yellow'
3='green'
4='red';
run;
proc report data=sashelp.prdsale;
column product quarter;
define quarter /
style(column)={background=qfmt.};
run;
By default, numeric variable is ANALYSIS usage, therefore refer to it by xxx.sum .
proc report data=sashelp.prdsale nowd;
column product quarter ;
/*define quarter/ group;*/
COMPUTE quarter;
IF quarter.sum >3
THEN CALL DEFINE(_col_, "style", "STYLE=[BACKGROUND=RED]");
ENDCOMP;
run;
Thanks Ksharp
Hi:
You can also accomplish what you want to do with a format, no CALL DEFINE needed.
Cynthia
proc format;
value qfmt 1='pink'
2='yellow'
3='green'
4='red';
run;
proc report data=sashelp.prdsale;
column product quarter;
define quarter /
style(column)={background=qfmt.};
run;
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 lock in 2025 pricing—just $495!
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.