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

Greetings, I am using the numeric variable _28DayRem to set the background of_28Day.

proc report data=WORK.QUERY_FOR_FCN4 missing nowd;
	column
		(_28DayRem _28Day);

	define _28DayRem / display ;
	define _28Day / display '28-Day' 
		style(header)={background=white foreground=black};
		compute _28Day;
			if _28DayRem = 0 then call define(_col_,"style",
				"style={background=white foreground=black}");
			else if _28DayRem < 0 then call define(_col_,"style",
				"style={background=Red foreground=white font_weight=bold}");
	  endcomp;
quit;

The colors are not responding to the IF statement, color change should be set when _28DayRem = -25:

2020-03-25_183712.png

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Espresso
Obsidian | Level 7

Thanks for the quick reply and advise. Cool script @ballardw, love the screenshot @Cynthia_sas 🙂

 

Honored to have heavy hitters respond, hence my embarrassment and apologies for my mistake...

 

Espresso_0-1585187337590.png

I had placed this option on a scrip that I include with just about every program as default.

So now with this change:

Espresso_1-1585190355930.png

Life's good:

Espresso_2-1585190479641.png

 

View solution in original post

4 REPLIES 4
ballardw
Super User

With my made up dummy data the text changes colors. You may have to provide a data step with your exact values.

 

It also isn't possible to tell if the table you posted is the desired output or your actual output. The result you show does have the text appearance change when the value is -25. I'm more concerned about why you 0 values are showing a red background.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.

Cynthia_sas
SAS Super FREQ

Hi:
I agree with @ballardw. With my fake data (shown below), I can cause bad highlighting by NOT accounting for the condition where the value is GT 0, but I get the correct highlighting. There must be something else in your code or your data that is not provided to us. My highlighting works, as shown in Report #2.

proc_report_highlight.png


Cynthia

Espresso
Obsidian | Level 7

Thanks for the quick reply and advise. Cool script @ballardw, love the screenshot @Cynthia_sas 🙂

 

Honored to have heavy hitters respond, hence my embarrassment and apologies for my mistake...

 

Espresso_0-1585187337590.png

I had placed this option on a scrip that I include with just about every program as default.

So now with this change:

Espresso_1-1585190355930.png

Life's good:

Espresso_2-1585190479641.png

 

ballardw
Super User

Glad that you found the solution and that my hint may have helped.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 654 views
  • 4 likes
  • 3 in conversation