BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
metallon
Pyrite | Level 9

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

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

metallon
Pyrite | Level 9

Hi Cynthia!

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

Thanks a lot!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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