BookmarkSubscribeRSS Feed
deleted_user
Not applicable
My second compute block doesn't appear to be working (ie compute rate).
The background is not changing to red when _c9_ >14.
I believe the problem is the "division in (3)" condition.

My other issue is that if I use both the rate compute block (without division) and the avg compute block then cells that should have yellow values with a red background just have yellow values (and no red background). Cells that should be red without yellow values are red when "division in (3)" is not specified.

Any suggestions?

proc report data=occ nowd
style(header)=[font_weight=bold];
options missing='0';
columns division lvl9 year, (rate avg);
define division / group;
define lvl9 / group;
define year / across;
define rate / analysis;
define avg / analysis;
compute avg;
if _c10_ <40 then call define
('_c9_',"style","style=[foreground=yellow]");
endcomp;
compute rate;
if _c9_>14 and division in (3) then call define
('_c9_',"style","style=[background=red]");
endcomp;

proc print data=test noobs; where division in (3) and _c9_>14; run;
division LVL9 _C3_ _C4_ _C5_ _C6_ _C7_ _C8_ _C9_ _C10_ _BREAK_
3 West 19 90 23 80 14 91 15 102
3 West1 22 33 12 30 16 31 25 32
2 REPLIES 2
deleted_user
Not applicable
Sorry, I left off one of the compute blocks.
The two compute blocks are:
compute avg;
if _c10_ <40 then call define ('_c9_',"style","style[foreground=yellow])";
endcomp;
compute rate;
if _c9_>14 and division in (3) then call define ('_c9_',"style","style=[background=red]");
endcomp;
run;quit;
deleted_user
Not applicable
My code isn't being posted correctly. There is a bug in this message board.
I guess if you can help me based on my question that would be great.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 690 views
  • 0 likes
  • 1 in conversation