- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the answer clear explanation Sir.