If you really need to use PROC TEMPLATE, try this one:
data test;
input id $ num pct;
cards;
A 7777 0.831
B 8888 0.123
C 9999 0.014
;
run;
ods path(prepend) work.templat(update);
proc template;
define style example / store=work.templat(update);
parent = styles.printer;
class data / color=red;
style data_text from data / color=cyan tagattr='format:@ type:string';
style data_number from data / color=purple tagattr='format:#,##0' fontweight=bold cellwidth=1cm;
style data_percent from data / color=magenta tagattr='format:0.0%' fontstyle=italic;
end;
quit;
%let xlfile=%sysfunc(pathname(work))/test.xlsx;
options device=png;
ods excel file="&xlfile" style=example;
* When named style elements are used in DEFINE, they are not inherited in
* CALL DEFINE. Instead, the style element reverts back to the default, Data. ;
proc report data=test nowd;
columns id num pct;
define id / display style(column)=data_text;
define num / display style(column)=data_number;
define pct / display style(column)=data_percent;
compute pct;
if id='C' then do;
call define(_row_, 'style', 'style=[backgroundcolor=yellow]');
end;
call define('id', 'style', 'style=data_text');
call define('num', 'style', 'style=data_number');
call define('pct', 'style', 'style=data_percent');
endcomp;
run;
ods excel close;
... View more