Hello everyone,
I'm using the ODS to create an excel report with alternating colors for rows.
I'm now trying to get a row to change color based on a returned value within the row.
if job_rc = 4 then yellow/orange.
Any suggestions to point me in the right direction of adding this functionality?
Regards,
Jonathan
ods excel file= "/folders/myfolders/report.xlsx" ;
proc report data=sashelp.class nowd ;
column name age;
define name/ "" display style={cellwidth=2.5in};
define age/ "" display style={cellwidth=2.5in};
compute age;
if age le 14 then
call define(_row_,"Style","Style={background=yellow}");
endcomp;
run;
ods excel close;
How are you creating your report. What ODS destination are you using?
Please post your code.
The quick answer is proc report with a compute column - search for papers on the topic.
ods excel file= "/folders/myfolders/report.xlsx" ;
proc report data=sashelp.class nowd ;
column name age;
define name/ "" display style={cellwidth=2.5in};
define age/ "" display style={cellwidth=2.5in};
compute age;
if age le 14 then
call define(_row_,"Style","Style={background=yellow}");
endcomp;
run;
ods excel close;
Hi,
ODS excel file= "~/YOURS.xlsx" ;
proc report data=DB.TABLE nowd ;
column name VALUE;
define CITY/ "" display style={cellwidth=3.0in};
define POPULATION/ "" display style={cellwidth=3.0in};
compute CITY;
if age LESS 50000 then
call define(_row_,"Style","Style={background=BLUE}");
end
comp;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.