The SAS Output Delivery System and reporting techniques

Proc Report and Conditional Formatting

Reply
Occasional Contributor
Posts: 15

Proc Report and Conditional Formatting

Using the below code I created the attached table (for simplicity I deleted the majority of the columns). I am trying to create a conditional format where if the number in the district row, AL column (first number) is greater than the number in the national row, AL column (second number) then the district number will be bold. The example illustrates what i am trying to achieve.  I have been trying to use call define to achieve this formatting, but to no avail. Any tips would be greatly appreciated. 

 

proc report data=math_domain_prof nowd spanrows
style(report)=[cellspacing=0pt cellpadding=0pt fontsize=11pt bordercolor=CX4BACC6];
where grade in (0:8);
column student_Grade_level_id D_N al geo ms no;
define student_Grade_level_id/ order order=DATA flow 'Grade' style={vjust=center BACKGROUND=white fontfamily=Calibri fontsize=7pt just=center borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=CX4BACC6 height=.05in
cellspacing=0 cellpadding=0}
style(header)=[background=CX4BACC6 font_weight=bold foreground=white JUST=center vjust=center fontfamily=Calibri fontsize=8pt width=8%
borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=CX4BACC6 height=.10in];
define D_N / 'District/National' group order=DATA flow style={BACKGROUND=white fontfamily=Calibri fontsize=7pt just=center borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.05in
cellspacing=0 cellpadding=0}
style(header)=[background=CX4BACC6 font_weight=bold foreground=white JUST=center vjust=center fontfamily=Calibri fontsize=8pt width=8%
borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.10in];
define albold / group noprint;
define al /'Algebra and Algebraic Thinking' group flow style={JUST=center fontfamily=Calibri fontsize=7pt borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.05in
cellspacing=0 cellpadding=0}
style(header)=[BACKGROUND=CX4BACC6 font_weight=bold foreground=white just=center fontfamily=Calibri fontsize=8pt width=15%
borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.10in vjust=center];
define no/ 'Numbers and Operations' flow style={JUST=center fontfamily=Calibri fontsize=7pt borderrightcolor=CX4BACC6 borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.05in
cellspacing=0 cellpadding=0}
style(header)=[BACKGROUND=CX4BACC6 font_weight=bold foreground=white just=center fontfamily=Calibri fontsize=8pt width=15%
borderrightcolor=CX4BACC6 borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.10in vjust=center];
define geo/ 'Geometry' flow style={JUST=center fontfamily=Calibri fontsize=7pt borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.05in
cellspacing=0 cellpadding=0}
style(header)=[BACKGROUND=CX4BACC6 font_weight=bold foreground=white just=center fontfamily=Calibri fontsize=8pt width=15%
borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.10in vjust=center];
define ms / 'Measurement and Data' flow style={JUST=center fontfamily=Calibri fontsize=7pt borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.05in
cellspacing=0 cellpadding=0}
style(header)=[BACKGROUND=CX4BACC6 font_weight=bold foreground=white fontfamily=Calibri fontsize=9pt width=15%
borderrightcolor=white borderbottomcolor=CX4BACC6 bordertopcolor=CX4BACC6 borderleftcolor=white height=.10in vjust=center];
compute after student_Grade_level_id / style={borderbottomwidth=3pt};
endcomp;
run;

 

 

Grand Advisor
Posts: 16,388

Re: Proc Report and Conditional Formatting

Can you please paste the code into a code object in the question, it looks like a piece of paper in the editor options. It's hard to read as is, and I think parts may have been truncated out as I see some defines with no CALL infront of it. Ideally, if you could simplify the question and include only the section of interest that would work too.
Occasional Contributor
Posts: 15

Re: Proc Report and Conditional Formatting

My apologies. Please see below. I have simplified the code by removing all of of the styles. My main goal is to create a conditional format on columns, al, no, geo, and ms. The table is currently set up to show a district percent and national percent by grade (please see attached picture in the original question). If the district percent is greater than the national percent, then I want to have that percent be bold. I could use proc format and create a long list of formats, but I was trying to find a quicker way around. Does that make more sense?

proc report data=math_domain_prof nowd spanrows
style(report)=[cellspacing=0pt cellpadding=0pt fontsize=11pt bordercolor=CX4BACC6];
where grade in (0:8);
column student_Grade_level_id D_N al geo ms no;
define student_Grade_level_id/ order order=DATA flow 'Grade';
define D_N / 'District/National' group order=DATA flow;
define al /'Algebra and Algebraic Thinking' flow;
define no/ 'Numbers and Operations' flow;
define geo/ 'Geometry' flow;
define ms / 'Measurement and Data' flow;
compute after student_Grade_level_id / style={borderbottomwidth=3pt};
endcomp;
run;
Post a Question
Discussion Stats
  • 2 replies
  • 491 views
  • 0 likes
  • 2 in conversation