BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15
Hello
Let's say that I have a data set that included summary information by customers grade.

Let's say that there is a macro variable called colorgrade and the task is to color the row with the chosen grade in red color.

What is the way to do it please?

%let colorgrade=10;
Data have;
Input grade nr obligo2205 obligo2204;
Cards:
2 80000 200 220
3 70000 190 210
4 200000 400 370
5 250000 500 480
6 280000 520 510
7 180000 280 320
8 140000 210 215
9 90000 140 130
10 30000 90 92
;
Run;
2 REPLIES 2
andreas_lds
Jade | Level 19

It is not possible to change the background colour of a row in a dataset.

 

Edit: If you want a report, using proc report would be my first choice. There are many papers explaining how to change the background colour conditionally, i am sure you will find something adaptable to your issue.

Ksharp
Super User
%let colorgrade=10;
Data have;
Input grade nr obligo2205 obligo2204;
Cards;
2 80000 200 220
3 70000 190 210
4 200000 400 370
5 250000 500 480
6 280000 520 510
7 180000 280 320
8 140000 210 215
9 90000 140 130
10 30000 90 92
;
Run;

proc report data=have nowd;
define grade/display;
compute grade;
if grade=&colorgrade. then call define(_row_,'style','style={background=red}');
endcomp;
run;

Ksharp_0-1659530792079.png

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 774 views
  • 0 likes
  • 3 in conversation