- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hey Guys,
quick question. I want to print a table via proc report and highlight certain parts via bold/italic/underlining. Unfortunately, I only manage to print a whole column bold like this:
But I would like the table to look something like this (e. g. if I only want to print the "4dr" part as bold) --> So everything besides "4dr" should be plain text and "4dr" should be printed as bold text.
My code so far looks like this and I did not manage to customize it accordingly
data cars;
set sashelp.cars (obs=20);
run;
ods pdf file="yourpath\test.pdf";
title;
ods pdf startpage=no;
ods layout start width=19cm height=28cm;
proc report data=cars;
column Make Model Type;
define Make / "MAKE" ;
define Model / "MODEL" ;
define Type / "TYPE" ;
compute Model;
if Make = 'Acura' then call define(_col_,'style','style={fontweight=bold}');
endcomp;
run;
ods layout end;
ods pdf close;
If you have got any hints for me how to achieve the desired result I'd be grateful. Thank you!
Kind regards
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Since it looks like you are using ODS output you should be able to use ODS ESCAPECHAR to embed the style setting into the value of your character variable. Change the FONTWEIGHT to make it bold or heavy. Make sure to make the variable long enough to contain the extra characters.
Example Let's also change the color to make it more obvious in the output.
data class ;
set sashelp.class;
where name=:'J';
length boldname $100 ;
boldname = tranwrd(name,'an','(*ESC*){style [fontweight=extra_bold color=red]an}');
format boldname;
run;
proc print data=class;
run;
Result
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Maybe @Cynthia_sas knew it .
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Since it looks like you are using ODS output you should be able to use ODS ESCAPECHAR to embed the style setting into the value of your character variable. Change the FONTWEIGHT to make it bold or heavy. Make sure to make the variable long enough to contain the extra characters.
Example Let's also change the color to make it more obvious in the output.
data class ;
set sashelp.class;
where name=:'J';
length boldname $100 ;
boldname = tranwrd(name,'an','(*ESC*){style [fontweight=extra_bold color=red]an}');
format boldname;
run;
proc print data=class;
run;
Result
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much Tom, you've saved my day 🙂