The SAS Output Delivery System and reporting techniques

PROC Report CELL Coloring condition

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 133
Accepted Solution

PROC Report CELL Coloring condition

Hi Experts,

I looked around and it seems my cell coloring condition (compute block) is correct but somehow the whole column is colored gray and not just the cell to which the condition applies.

Why is that?

proc report data=test;

COLUMN OBER_GR STOFFOBERGRUPPETEXT UNTER_GR STOFFUNTERGRUPPETEXT PARAM PARAM_BEZ SPECIES

        ('Comp0'(

                     ('' STOFFART_EB))

                     ('' SOLL_EB)

                     ('' SAMPLES_EB)

                       ('' ERFUELLT_EB)

                     ('' PERC_EB))

        ('Comp1'(

                     ('' SOLL_SB))

                     ('' STOFFART_EB)

                     ('' SAMPLES_SB)

                     ('' ERFUELLT_SB)

                     ('' PERC_SB));

DEFINE OBER_GR / ORDER'Obergruppe';

DEFINE STOFFOBERGRUPPETEXT / ORDER'Obergruppe Text';

DEFINE UNTER_GR / ORDER'Untergruppe';

DEFINE STOFFUNTERGRUPPETEXT / ORDER'Untergruppe Text';

DEFINE PARAM / ORDER'Parameter';

DEFINE PARAM_BEZ / 'Parameter bez.';

DEFINE STOFFART_EB / 'P/W';

DEFINE STOFFART_SB / 'P/W';

DEFINE SPECIES / 'SPECIES';

DEFINE SOLL_EB / 'Soll';

DEFINE SAMPLES_EB / 'Haben';

DEFINE SOLL_SB / 'Soll';

DEFINE SAMPLES_SB / 'Haben';

DEFINE ERFUELLT_EB / 'Erfüllt';

DEFINE PERC_EB / '%';

DEFINE ERFUELLT_SB / 'Erfüllt';

DEFINE PERC_SB / '%';

COMPUTE ERFUELLT_EB;

IF 0 > ERFUELLT_EB  THEN call define(_col_,"style","style={background=#C2C6CC}");

ENDCOMP;

COMPUTE ERFUELLT_SB;

IF 0 > ERFUELLT_SB  THEN call define(_col_,"style","style={background=#C2C6CC}");

ENDCOMP;

run;

ods _all_ close;


Accepted Solutions
Solution
‎07-24-2015 09:54 AM
SAS Super FREQ
Posts: 8,739

Re: PROC Report CELL Coloring condition

Hi:

  You have 2 columns being tested ERFUELLT_EB and ERFUELLT_SB and you only show code, not data. So no one can test your code. However, have you tested your variables? Are ERFUELLT_EB and ERFUELLT_SB character or numeric. Your IF statement implies that they are numeric. That means they have a default usage of SUM. The method by which you need to refer to numeric variables in a compute block is

variablename.statistic

or in your case

ERFUELLT_EB.sum or ERFUELLT_SB.sum

-- and I don't see that. However, you should be getting messages in the log if the referencing is wrong.

  Also, when I look at the color C2C6CC, I see the color gray, so I assume your issue is with the condition testing and not with the color itself.

cynthia

View solution in original post


All Replies
Solution
‎07-24-2015 09:54 AM
SAS Super FREQ
Posts: 8,739

Re: PROC Report CELL Coloring condition

Hi:

  You have 2 columns being tested ERFUELLT_EB and ERFUELLT_SB and you only show code, not data. So no one can test your code. However, have you tested your variables? Are ERFUELLT_EB and ERFUELLT_SB character or numeric. Your IF statement implies that they are numeric. That means they have a default usage of SUM. The method by which you need to refer to numeric variables in a compute block is

variablename.statistic

or in your case

ERFUELLT_EB.sum or ERFUELLT_SB.sum

-- and I don't see that. However, you should be getting messages in the log if the referencing is wrong.

  Also, when I look at the color C2C6CC, I see the color gray, so I assume your issue is with the condition testing and not with the color itself.

cynthia

Frequent Contributor
Posts: 133

Re: PROC Report CELL Coloring condition

Hi Cynthia!

Thanks a lot! Both are indeed numeric variables and nowhere I read that you have to add .sum.

Thanks a lot!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 417 views
  • 0 likes
  • 2 in conversation