Hi,
I am trying to apply condition formatting to a variable based on another numeric variable.
The variable "num" is always populated.
Unfortunately, without any error message or warning, the conditional formatting doesn't work.
When num=9999 none of the lines are italicized.
compute var;
if num =9999 then call define(_COL_,'style','style={font_style=italic}');
endcomp;
When num ne 9999 all lines are italicized.
compute var;
if num ne 9999 then call define(_COL_,'style','style={font_style=italic}');
endcomp;
When missing(num)=1 all lines are italicized.
compute var;
if missing(num)=1 then call define(_COL_,'style','style={font_style=italic}');
endcomp;
However, when do the following test on the dataset used in the proc report the variable num seems fine:
data dataset_test;
set dataset;
if num=9999;
run;
NOTE: There were 34 observations read from the data set WORK.dataset.
NOTE: The data set WORK.dataset_TEST has 24 observations and 25 variables.
Also note that I have the following lines prior to the conditional formatting.
columns var num;
define num / order noprint;
Any Idea why the variable num is not correctly assessed?
Thanks!
It is not clear what code you actually run.
But it looks like you might be trying to reference a variable BEFORE it exists in the report.
If VAR is before NUM in the report then in the compute block for VAR the value of NUM is not known yet.
Here's my code:
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.