Hey everyone, this is my first post so bear with me:
I am attempting to produce a PROC REPORT that has different colors based on score (pretty common, lots of literature). The problem is I am having a phantom problem that nobody in my office can explain. Here is the cose.
proc report data=selected_peds nowd;
where measure='Well Care Visits 7-21 Years'
OR measure='Well Child Visits 3-6 Years';
column 'Practice Group'n Measure 'Product Line'n denominator score2 target2 QI_2011 'Quality Index (QI)'n;
define 'Practice Group'n / group;
define 'Product Line'n / group;
define measure / group;
define denominator / display "n";
define score2 / "Measure Score " display format=percent.;
define target2 / "Measure Target" display format=percent.;
define QI_2011 / display 'QI - 2011';
define 'Quality Index (QI)'n / 'QI - 2012' display;
compute 'Quality Index (QI)'n;
if 'Quality Index (QI)'n < QI_2011 then
call define(_col_, 'style', 'style=[foreground=red]');
endcomp;
compute score2;
if score2 < target2 then do;
call define(_col_,'style','style={foreground=red}');
end;
ELSE call define(_col_,'style','style={foreground=green}');
endcomp;
compute target2;
if score2 < target2 then do;
call define(_col_,'style','style={foreground=red}');
end;
ELSE call define(_col_,'style','style={foreground=green}');
endcomp;
run;
now notice something, the compute for score2 and target2 have the exact same logic and yet in the results target2 comes up correct (some green and some red) and score2 does not (all green).
Both variables are formatted the same in the dataset and in the REPORT.
Any ideas?
using base 9.2 with Enterprise Guide 4.3
thanks!
Somewhere in the middle of the doc:
Base SAS(R) 9.2 Procedures Guide
If a compute block is associated with a report item, then PROC REPORT executes the compute block on every row of the report when it comes to the column for that item. The value of a computed variable in any row of a report is the last value assigned to that variable during that execution of the DATA step statements in the compute block. PROC REPORT assigns values to the columns in a row of a report from left to right. Consequently, you cannot base the calculation of a computed variable on any variable that appears to its right in the report.
Somewhere in the middle of the doc:
Base SAS(R) 9.2 Procedures Guide
If a compute block is associated with a report item, then PROC REPORT executes the compute block on every row of the report when it comes to the column for that item. The value of a computed variable in any row of a report is the last value assigned to that variable during that execution of the DATA step statements in the compute block. PROC REPORT assigns values to the columns in a row of a report from left to right. Consequently, you cannot base the calculation of a computed variable on any variable that appears to its right in the report.
thanks a lot
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.