BookmarkSubscribeRSS Feed
mcook
Quartz | Level 8

The following code produces these variables and spanning header.  

 

header_color.PNG

 

ods rtf path = "&ODS_Path."
	file = "&CompSub._Percents" ;

proc report data=percenttable_&CompSub. style(header) = [background = lightblue];;
title "&Sub.";
	column year ('Percent' (Minimal Basic Passing Proficient Advanced PassingPlus ProficientPlus));
	define year / center;
	define minimal /center;
	define basic / center;
	define passing / center;
	define proficient / center;
	define advanced / center;
	define passingplus / 'Passing +' center style(column)=[cellwidth=125] ;
	define proficientplus / 'Proficient +' center style(column)=[cellwidth=130] ;

run;

ods rtf close;

is it possible to make ONLY the spanning header (Percent) light blue?

 

 

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  In this example using SASHELP.SHOES, how would you envision the cell above REGION to be treated? As shown in #1 or #2a or 2b?

Cynthia_sas_1-1604683417658.png

 

This paper has some examples of applying colors to headers: https://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf Look at the examples on pages 12 and 13.

Cynthia

mcook
Quartz | Level 8

yes, just like 2b.  though perhaps with everything but the percent header a uniform color. 

Cynthia_sas
SAS Super FREQ

Hi:

Like this:

Cynthia_sas_0-1604699610484.png

With all the different colors the cell above Region didn't bother me, but with the lower headers all the same color, I think I like #1 better now. Note that for #2b, with helper variables, I had to make the helper variables in a separate DATA step program. Also, to get the cell above REGION a different color, some text had to be inserted into that cell so the color could be changed.

 

Cynthia

 

  Here's the code I used for the above.

data shoes;
  set sashelp.shoes;
  regback='.';
  otherback = 'Spanning Header';
  numvar = 1;
run;

ods rtf file = "c:\temp\span_color.rtf";
 
proc report data=sashelp.shoes(obs=3)
    style(header) = [background = lightblue]; 
    title "alt 1) Only Spanning Header light blue AND cell above Region";
	column region ('Spanning Header'  subsidiary product sales inventory returns);
	define region / style(header)={just=c background=lightyellow};
	define subsidiary /style(header)={just=c background=lightyellow};
	define product /style(header)={just=c background=lightyellow};
	define sales / style(header)={just=c background=lightyellow};
	define inventory / style(header)={just=c background=lightyellow};
	define returns / style(header)={just=c background=lightyellow};
 run;

  
 proc format;
   value $hdrf 'Region' = 'lightyellow'
               'Subsidiary' = 'lightyellow'
			   'Product' = 'lightyellow'
			   'Total Sales' = 'lightyellow'
			   'Total Inventory' = 'lightyellow'
			   'Total Returns' = 'lightyellow'
			   'Spanning Header' = 'lightblue'
			   '~' = 'lightyellow'
			   other = 'white';
     value $h2fm '~' = 'lightyellow';
 run;

proc report data=sashelp.shoes(obs=3)
    style(header)={just=c background=$hdrf. color=$h2fm.};
    title "alt 2a) Use format for changing header backgrounds";
    column ('~' region)  ('Spanning Header' subsidiary product sales inventory returns);
	define region / 'Region' ;
	define subsidiary / 'Subsidiary';
	define product / 'Product';
	define sales /  'Total Sales';
	define inventory / 'Total Inventory';
	define returns /  'Total Returns';
 run;

proc report data=shoes(obs=3);
    title "alt 2b) Use 'helper' variables for changing header backgrounds";
    column numvar regback,region  otherback,(subsidiary product sales inventory returns);
    define numvar / group ' ' noprint;
	define regback / across ' ' style(header)={just=c background=lightyellow color=lightyellow};
	define region / style(header)={just=c background=lightyellow};
	define otherback / across ' ' style(header)={just=c background=lightblue};
	define subsidiary /style(header)={just=c background=lightyellow};
	define product /style(header)={just=c background=lightyellow};
	define sales / style(header)={just=c background=lightyellow};
	define inventory / style(header)={just=c background=lightyellow};
	define returns / style(header)={just=c background=lightyellow};
 run;

ods rtf close;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2025 views
  • 0 likes
  • 2 in conversation