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-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 556 views
  • 0 likes
  • 1 in conversation