The SAS Output Delivery System and reporting techniques

Set Header Color using Template.

Accepted Solution Solved
Reply
Super Contributor
Posts: 443
Accepted Solution

Set Header Color using Template.

proc template;  
	  define statgraph statGraphName style ;
	    dynamic TITLE1 TITLE2 TITLE3;
		begingraph;
		  entrytitle TITLE1;

How can I include a color style along with other options in proc template?  I know this is a simple question but I’m having a hard time finding examples in documentation.  My objective is to set the header color for the template.


Accepted Solutions
Solution
‎05-03-2016 02:29 PM
SAS Super FREQ
Posts: 8,645

Re: Set Header Color using Template.

Hi, This worked for me in SAS 9.4 M3, but did not work in SAS 9.4 M0 (got an error on PANELBY statement). I don't have any other versions to test with. You might want to check with Tech Support or post your question on the SAS/GRAPH and ODS GRAPHICS forum. ( I like pink better than red. So the color should not make a difference -- however, SAS does have a registry list of colors and if you specify a color that isn't in the registry list, it is possible that the color you specify will be mapped to a different color. This happens when you use "named" colors like aliceblue or red or pink -- they always get "translated" to their RGB equivalent.)

 

cynthia

 

headerbackcolor.png

 

and, when I use CXFFBA00, this is what I get...is this what you're expecting???

 

cxffba00.png

View solution in original post


All Replies
Grand Advisor
Posts: 16,383

Re: Set Header Color using Template.

Define header colour, is that the text, the background, the border of the header?

Super Contributor
Posts: 443

Re: Set Header Color using Template.

[ Edited ]

Boarder of the header.  In proc report it would be style(header)=[background=#FFBA00]

 

I'm trying to do the same thing for proc sgpannel.

Attachment
Super Contributor
Posts: 443

Re: Set Header Color using Template.

proc sgpanel data=sashelp.class;

panelby sex / headerbackcolor=red;

 scatter y=age x=age;

 run;

Super Contributor
Posts: 443

Re: Set Header Color using Template.

This doesn't work for setting custom colors FFBA00 is changes the color but has the same result as F9DF97.

Solution
‎05-03-2016 02:29 PM
SAS Super FREQ
Posts: 8,645

Re: Set Header Color using Template.

Hi, This worked for me in SAS 9.4 M3, but did not work in SAS 9.4 M0 (got an error on PANELBY statement). I don't have any other versions to test with. You might want to check with Tech Support or post your question on the SAS/GRAPH and ODS GRAPHICS forum. ( I like pink better than red. So the color should not make a difference -- however, SAS does have a registry list of colors and if you specify a color that isn't in the registry list, it is possible that the color you specify will be mapped to a different color. This happens when you use "named" colors like aliceblue or red or pink -- they always get "translated" to their RGB equivalent.)

 

cynthia

 

headerbackcolor.png

 

and, when I use CXFFBA00, this is what I get...is this what you're expecting???

 

cxffba00.png

Super Contributor
Posts: 443

Re: Set Header Color using Template.

Cynthia, thanks for solving the color display.

 

How did you convert the hex color FFBA00 to CXFFBA00 ?  I need to make sure it is the same color.

Super Contributor
Posts: 443

Re: Set Header Color using Template.

Do I need to create a style to create a color gradient for the bars of a group by in sgpannel?  Is this done style template?  Can you recomend a good example to base off of?

SAS Super FREQ
Posts: 8,645

Re: Set Header Color using Template.

Off the top of my head, I think that gradients do need to be specified in the style template. I think it is a startcolor and an endcolor style attribute that defines the gradient range. The better place to post this question would be in the ODS GRAPHICS forum or by opening a track with Tech Support.
Here's the web page that describes the ODS STYLE attributes/elements that can be used with ODS GRAPHICS:
http://support.sas.com/documentation/cdl/en/grstatproc/67909/HTML/default/viewer.htm#n02bywwj20lelzn...

cynthia
SAS Super FREQ
Posts: 8,645

Re: Set Header Color using Template.

hi, David...I did not do any "translation" .. the FF is Red value in hex; the BA is Green value in hex; the 00 is Blue value in hex. All I did was put CX in front of the number because that is how SAS determines that the number is an RGB number. In HTML, you might be able to get away without the # in #FFBA00 -- but for SAS and ODS with RGB values it is better to preface them with CX.

If you want to verify a color value, go on the web to one of the "interactive" RGB color pickers, sometimes they are called HTML color pickers and spin the values or type the values in to see the color.

In the SAS color naming systems, you can have CX for RGB colors, HLS for Hue, Lightness and saturation, GRAY## for grayscale values and a few others, like HSV or CMYK as described here:
http://support.sas.com/documentation/cdl/en/grstatug/67914/HTML/default/viewer.htm#p0edl20cvxxmm9n1i...

cynthia
Post a Question
Discussion Stats
  • 9 replies
  • 635 views
  • 3 likes
  • 3 in conversation