Hi All,
I am stuck with highlighting some cells of a column based on a comparison of cells of another column. In the following code I tried to use CALL DEFINE so that it highlights when column _c2_ is bigger than _c3_. Can someone help me please.
PROC SQL;
CREATE TABLE sale AS
SELECT country,
region,
prodtype,
product,
actual LABEL=''FORMAT=comma10.2,
predict LABEL=''FORMAT=comma10.2,
month
FROM sashelp.prdsale
WHERE mod(monotonic(),75)=0
ORDER BY ranuni(94612);
QUIT;
PROC REPORT DATA=sale NOWINDOWS MISSING HEADLINE HEADSKIP OUT=test;
COLUMN country (region prodtype) , predict;
DEFINE country / GROUP;
DEFINE region / ACROSS;
DEFINE prodtype / ACROSS;
RBREAK AFTER / SUMMARIZE SKIP ol;
COMPUTE predict;
IF _c2_>_c3_.sum THEN CALL DEFINE (_Col_, "style", "style={background=Yellow}");
ENDCOMP;
RUN;
proc report data=sale nowindows missing headline headskip out=test;
column country (region prodtype) , predict;
define country / group;
define region / across;
define prodtype / across;
rbreak after / summarize skip ol;
compute region;
if _c2_>_c3_ then call define (_col_, "style", "style={background=yellow}");
endcomp;
run;
it worked for me
IF _c2_> _c3_ and country = ' ' THEN CALL DEFINE (_Col_, "style", "style={background=Yellow}");
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.