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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1278 views
  • 0 likes
  • 2 in conversation