Hi, I wonder how to change the background color of a text string via ODS PDF. It works at ODS RTF, but I don't know why it does not work at ODS PDF. Here is the code:
data aaa;
a=cat('abc',"^{style[backgroundcolor=pink foreground=red]defg}","hi");
output;
a=cat('abc',"^{style[background=pink foreground=red]defg}","hi");
output;
run;
ods escapechar='^';
ods pdf file="test.pdf";
ods rtf file="test.pdf";
proc print data=aaa;
run;
ods _all_ close;
The ODS RTF output returns this, and that is what I want: red text with pink background.
But ODS PDF output returns just red text, background color does not change.
Can anyone show me any issue from my code? Thanks!
I ran your code and got the same results. I used two different means to open the pdf, so I don't think it's your pdf reader that is at issue.
The fact that the code works for one ODS destination but not another suggests that one of the following may be true
a) there could be a bug in the SAS software
b) this feature just isn't supported in pdf
I don't really know which it is in this case. @Cynthia_sas seems to know a lot on this subject. Perhaps if she has time she can weigh in.
Jim
Thank you, @Cynthia_sas. It's about time somebody showed up around here who actually knows what they're talking about...
Jim
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.