hi @Cynthia_sas :
Thanks so much for the details of diagnosis.
Example1:
here is the code. It worked before. I didn't say it clearly :
I am asking if there is a way to highlight partial cell (NOT highlight partial of a text string)
ods excel options ; proc report data = rpt nowd split='*' missing style(header)=[just=center];
/*columns variable order to correctly display compute block*/ column subject dt bdt flagdt;
define subject / "ID" order=data ; define dt / "Date/Time" ; define bdt / "Date/Time" ; define flagdt / display noprint; compute flagdt; if flagdt = "ti" then do; call define("compress(substr(dt,12,8))",'style','style = [background = yellow]'); call define("compress(substr(bdt,12,8))", 'style','style = [background = yellow]'); end; else if flagdt = "dt_ti" then do; call define("dt",'style','style = [background = purple]'); call define("bdt", 'style', 'style = [background = purple]'); end; endcomp; run;
Example2: escapchar =' ^'
I tested the code, somehow it didn't work ,here is the code: please advise. thanks again.
Purple
proc sort data=sashelp.shoes out=newshoes;
where region contains "Europe" and sales >100000 and
(product contains "Casual" or product contains "Dress");
by region product;
run;
data newshoes;
set newshoes;
product=strip(product);
region=strip(region);
run;
/*output*/
title;
footnote;
ods results off;
ods listing close;
ods escapechar = '^';
ods excel file="C\test.xlsx"
style=excel
options
(row_repeat='header'
frozen_headers="ON"
autofilter ="all"
frozen_rowheaders="ON"
ROWBREAKS_INTERVAL= 'OUTPUT'
sheet_label=' '
embedded_titles='YES'
FitToPage='ON'
orientation="landscape"
flow="ROWHEADERS" );
ods excel options (sheet_name="Testcolor") ;
proc report data=newshoes nowd split='*' missing style(header)=[just=center];;
title 'test';
column region showreg product showprod sales inventory returns;
define region/display;
define showreg/computed;
define product/display;
define showprod/computed;
define inventory/display;
define returns/display;
compute showreg/character length=80;
showreg=catx('',scan(region,1,' '),'^(style[color=orange font_weight=bold]',scan(region,2,' '),')');
endcomp;
compute showprod/character length=80;
if scan(product,2,' ') = 'Casual' then do;
showprod=catx(' ', scan(product,1,' '),'^(style[color=purple font_wight=bold]',scan(product,2,' '),')');
end;
if scan(product,2,' ') = 'Dress' then do;
showprod=catx(' ', scan(product,1,' '),'^(style[color=green font_wight=bold]',scan(product,2,' '),')');
end;
endcomp;
run;
ods excel close;
ods results on;
ods listing;
ods output excel :
... View more