BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sebster24
Quartz | Level 8

Hello, I am currently presenting some results in proc report and intend to apply some conditional formatting to a summarize result. 

I am using proc report for its ease in exporting the figures to latex. 

I have written below the following code::



proc report data= SASHELP.SHOES
style(header)=[color=black  fontfamily=helvetica fontsize=1 background=yellow fontweight=bold];
column region Stores;
define region / "region" display style(column)=[width=2cm] group;
define stores/"stores" display style(column)=[width=3.5cm] mean; 
rbreak after/ summarize style=Header;
compute after;
region="Mean";
endcomp;

compute stores;
if _break_="_RBREAK_" then do;
	if stores >= 5 then call define('stores.mean','style','style={backgroundcolor=green}');
	else if stores < 5 then call define('stores.mean','style','style={backgroundcolor=yellow}');
	else if stores < 2 then call define('stores.mean','style','style={backgroundcolor=red}');
end;
endcomp;
run;

My issue is the output (mean) of stores (mean=11.648) should have a background colour "green", given the "if" condition. I am unable to figure out why it is "Yellow".

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
JosvanderVelden
SAS Super FREQ
If you have not found the error yourself yet use:
if stores.mean ...
else if stores.mean ...
else if stores.mean ...

View solution in original post

1 REPLY 1
JosvanderVelden
SAS Super FREQ
If you have not found the error yourself yet use:
if stores.mean ...
else if stores.mean ...
else if stores.mean ...

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1192 views
  • 0 likes
  • 2 in conversation