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-2024.png

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.

 

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.

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
  • 2 replies
  • 666 views
  • 0 likes
  • 3 in conversation