BookmarkSubscribeRSS Feed
nirali514
Obsidian | Level 7

How do I unbold the headers in proc report using sasdocprinter. I would also like to conditionally highlight cells gray using sasdocprinter. Let's say I want the number 50 to be highlighted in the column panel. How would I do this?  My escapechar is "^" but I am not sure where to place the unbolding and conditional formatting in order to work.

 

Thank you for all the help!

 

Currently I have the following:

 

 

proc report data = perm.data nowindows headline headskip missing center

style(report)=[cellspacing=2 borderwidth=2 bordercolor=black]

style(header) = { font_face = 'Times New Roman' font_size = 10pt just = center cellheight=.52in}

 

 

 

style(column) = {font_face = 'Times New Roman' font_size = 10pt just = center /*asis = on*/ cellheight=.2in};

column panel n min max mean median std stderr cv pvaluen ;

define panel / display /*order*//*group*/ ' / /Panel' center style=[cellwidth=12mm /*cellheight=.2in*/];

define n / display ' / /N' center style=[cellwidth=10mm /*cellheight=.2in*/];

define min / display format = 12.1 ' / Min/Response' center style=[cellwidth=18mm /*cellheight=.2in*/];

define max / display format = 12.1 ' / Max/Response' center style=[cellwidth=18mm /*cellheight=.2in*/];

define mean / display format = 12.1 ' / Mean/Response' center style=[cellwidth=18mm /*cellheight=.2in*/];

define median / display format = 12.1 ' / Median/Response' center style=[cellwidth=18mm /*cellheight=.2in*/];

define std / display format = 12.3 ' / /Std. Dev' center style=[cellwidth=16mm /*cellheight=.2in*/] flow ;

define stderr / display format = 12.3 ' / /Std. Err' center style=[cellwidth=15mm /*cellheight=.2in*/] ;

/*Don't multiply cv by 100 in SAS, it will be formatted here*/

define cv / display format = percent8.1 ' / /%CV' center style=[cellwidth=15mm /*cellheight=.2in*/];

define value/ display format = 12.3 'P-Value for/Normality/Test' center style=[cellwidth=20mm /*cellheight=.2in*/];

compute value;

if value<=0.001;

call define (_10_, "style", "style=[background=ltgray]");

 

endcomp;

 

run;

1 REPLY 1
ballardw
Super User

The style element Fontweight can take the following options:

FONTWEIGHT=weight

where weight is any of the following:

MEDIUM

BOLD

DEMI_BOLD

EXTRA_BOLD

LIGHT

DEMI_LIGHT

EXTRA_LIGHT

 
in any place you are specifying any style element. Not all fonts and destinations support all of the weights but Medium usually works.
 
Highlighting based on a specific value, sometimes refered to as Traffic lighting from green/yellow/red values, could be done in a compute block or by having a custom format indicate color values and use the format for the background/text/ whatever style element .you want to affect.
Here's an example from the online documentation:
proc format;
value proffmt low-<0='red'
0-high='green';
run;

proc report data=sashelp.prdsale;
column country predict actual diff;
define country /group;
define diff /'Difference' computed format=dollar12.2 
   style(column)=[backgroundcolor=proffmt.];

compute diff;
diff = predict.sum - actual.sum;
endcomp;
run;
 

 

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 2555 views
  • 1 like
  • 2 in conversation