BookmarkSubscribeRSS Feed
gzr2mz39
Quartz | Level 8
style=[background=orange font_weight=bold] in the compute block is not being applied. Any suggestions?
Thank you.

proc report data=org nowd contents="Claims"
style(header)=[font_weight=bold];
options missing='0';
column department div tot_osha;
define department /group 'Customer Service' width=18 style(column)={just=l} order=data;
define div / group noprint;
define tot_osha / 'Total' style(column)={background=gold};
compute department;
if div in (1,6,7,8,9,10) then call define(_row_,"style","style=[background=orange font_weight=bold]");
endcomp;
where mdoi=1;
run;
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
As discussed in these previous forum postings, PROC REPORT builds a report row from LEFT to RIGHT, based on the order of the variables in the COLUMN statement.
http://support.sas.com/forums/thread.jspa?messageID=36032賀
http://support.sas.com/forums/thread.jspa?messageID=9483┋
http://support.sas.com/forums/thread.jspa?messageID=24350弞

So, given your COLUMN statement,
[pre]
column department div tot_osha;
[/pre]

When PROC REPORT is putting DEPARTMENT on each report row, it has no visibility of the value for the DIV item, because DIV has not been placed on the report row yet. So you cannot use DIV in the compute block for DEPARTMENT. There's no reason, since DIV is a NOPRINT item that you couldn't swap the order of the two items in the COLUMN statement -- unless that would mess up the ordering of the rows.

Or, you could just do your CALL DEFINE in a COMPUTE block for DIV -- you can style a row and have a COMPUTE block for a NOPRINT column.

cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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