Help using Base SAS procedures

Proc Report Compute Block

Reply
N/A
Posts: 0

Proc Report Compute Block

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
N/A
Posts: 0

Re: Proc Report Compute Block

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;
N/A
Posts: 0

Re: Proc Report Compute Block

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.
Ask a Question
Discussion stats
  • 2 replies
  • 107 views
  • 0 likes
  • 1 in conversation