The SAS Output Delivery System and reporting techniques

Excel

Accepted Solution Solved
Reply
Contributor
Posts: 70
Accepted Solution

Excel

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


Accepted Solutions
Solution
‎01-17-2016 09:56 PM
Grand Advisor
Posts: 9,336

Re: Excel


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;

View solution in original post


All Replies
Grand Advisor
Posts: 16,416

Re: Excel

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. 

Solution
‎01-17-2016 09:56 PM
Grand Advisor
Posts: 9,336

Re: Excel


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;
Contributor
Posts: 70

Re: Excel

Hello yes I was able to find documentation on the topic to get the issue resolved.
New Contributor
Posts: 3

Re: Excel

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;

Post a Question
Discussion Stats
  • 4 replies
  • 453 views
  • 1 like
  • 4 in conversation