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;
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
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
Hi Cynthia!
Thanks a lot! Both are indeed numeric variables and nowhere I read that you have to add .sum.
Thanks a lot!
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.
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.