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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 648 views
  • 0 likes
  • 3 in conversation