Hi, Lisa:
The original poster said he could not post his code or data. So here's a simple example using SASHELP.CLASS
Note how the call define based on NAME is changing the color of font on the whole row for Alfred to purple. But the tests for age still impact the format for the HEIGHT and WEIGHT columns. With the PROC REPORT ability to change the style and format of a single column, one of the neat things is that the last column listed on the report row can have a COMPUTE block that "touches" or applies styles and formats with CALL DEFINE to any of the other columns on the report row. There are a few more complicated rules around using COMPUTE blocks and CALL DEFINE, but you would learn about those as you read the PROC REPORT documentation and search here in the forums for previous answers to questions like this.
Here's the full code I used to create the above output:
proc sort data=sashelp.class out=class;
by age;
run;
ods excel file='c:\temp\diff_formats.xlsx'
options(embedded_titles='yes');
proc report data=class;
title 'Using Call Define to format rows differently based on a condition';
column age name sex height weight;
define age / display;
define name / display;
define sex / display;
define height / display;
define weight/display;
compute weight;
** in the compute block for weight, you can "touch" all the columns on the report row;
if name = 'Alfred' then do;
call define(_row_,'style','style={font_weight=bold color=purple}');
end;
if age = 12 then do;
call define('height','format','z8.2');
call define(_col_,'format','z8.2');
end;
else if age=14 then do;
call define('height','format','6.2');
call define(_col_,'format','6.2');
end;
endcomp;
run;
ods excel close;
title;
You should be able to run this code because SASHELP.CLASS should be available in every installation of SAS.
Hope this helps,
Cynthia
... View more