New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sivastat08
Pyrite | Level 9

how to provide conditional formatting in cell in proc report in sas

 

PROC SQL INOBS=100;
CREATE TABLE WORK.QUERY_FOR_CARS AS
SELECT t1.Make,
t1.Model,
t1.Type,
t1.Origin,
t1.DriveTrain,
t1.MSRP,
t1.Invoice,
t1.EngineSize,
t1.Cylinders,
t1.Horsepower,
t1.MPG_City,
t1.MPG_Highway,
t1.Weight,
t1.Wheelbase,
t1.Length
FROM SASHELP.CARS t1;
QUIT;

 

proc report data=work.query_for_cars;
title HEIGHT=.25in 'Second Level Audit Findings by Client and Auditor' bold;
column Cylinders DriveTrain EngineSize Horsepower Invoice ;
define Cylinders/center;
define DriveTrain/center;
define EngineSize/center;
compute EngineSize;
if EngineSize < 3 then
call define(_col_,"style","style={background=red}");
endcomp;
run;

 

this report shows red highlighter for column.i need EngineSize < 3 should be red color

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Sometimes you have to be careful with the DEFINE. Numeric variables will default to SUM analysis and that does not appear to be how you are using Enginesize.

 

proc report data=work.query_for_cars;
title HEIGHT=.25in 'Second Level Audit Findings by Client and Auditor' bold;
column Cylinders DriveTrain EngineSize Horsepower Invoice ;
define Cylinders/center;
define DriveTrain/center;
define EngineSize/center display;
compute EngineSize;
   if EngineSize < 3 then
   call define(_col_,"style","style={background=red}");
endcomp;
run;

View solution in original post

2 REPLIES 2
ballardw
Super User

Sometimes you have to be careful with the DEFINE. Numeric variables will default to SUM analysis and that does not appear to be how you are using Enginesize.

 

proc report data=work.query_for_cars;
title HEIGHT=.25in 'Second Level Audit Findings by Client and Auditor' bold;
column Cylinders DriveTrain EngineSize Horsepower Invoice ;
define Cylinders/center;
define DriveTrain/center;
define EngineSize/center display;
compute EngineSize;
   if EngineSize < 3 then
   call define(_col_,"style","style={background=red}");
endcomp;
run;
sivastat08
Pyrite | Level 9

Thanks for the answer clear explanation Sir.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1811 views
  • 0 likes
  • 2 in conversation