BookmarkSubscribeRSS Feed
tommy81
Obsidian | Level 7
Hi ,

I have a dataset with a couple of colums

Unfortunately i need to highligh only one row based on the value of the first colum.

Please could somebody suggets a code to do it.

Something like if firstcolum=sales , then highlight the entire row using colors or bold


help would be deeply apprecited
2 REPLIES 2
polingjw
Quartz | Level 8
You need to use a call define statement with the _row_ argument within a compute block. For example:

If _c1_ = ‘sales’ then call define (_row_, ‘style’, ‘style={background=yellow}’);
SASPhile
Quartz | Level 8
Try this:
DATA TEST;
LENGTH ID $ 5 NAME $ 10 ADDRESS $ 15;
INPUT ID $ NAME $ ADDRESS $ QTY;
DATALINES;
SALES John Philadephia 25
BUY Adams Tampa 30
SALES Adams Orlando 30
BUY Mark Austin 30
;
RUN;

/* CREATE MACRO VARIABLE WITH ALL DUPLICATE PHYID VALUES */
DATA TEST1;
SET TEST;
IF ID='SALES' THEN FLAG='1';
ELSE FLAG='0';
RUN;

ODS LISTING CLOSE;
ODS HTML FILE='C:\Documents and Settings\Desktop\test.xls';

PROC REPORT DATA=TEST1 NOWINDOWS;
COLUMNS ID NAME ADDRESS QTY FLAG;
DEFINE FLAG/NOPRINT;
COMPUTE flag;
IF FLAG='1' THEN CALL DEFINE(_ROW_, "STYLE", "STYLE=[BACKGROUND=blue]");
ENDCOMP;
RUN;
ODS HTML CLOSE;
ODS LISTING;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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