Hi all,
I would ask for your help on the following.
I am using this code:
data have;
length CUSTID 8 Name $20 Address $30 Product $20;
input CUSTID Name $ Address $ Product $ Value Quantity;
datalines;
1 A CityA Laptop 1200 2
2 B CityB Phone 800 1
3 C CityC Tablet 400 3
4 D CityD Monitor 300 2
5 E CityE Keyboard 50 5
;
run;
PROC REPORT DATA=have;
COLUMN
("Customer Information"
(CUSTID Name Address)
)
("Sales Information"
(Product Value Quantity)
);
define CUSTID / display "CUSTID" style(header)=[background=cx00B050 foreground=white];
define Name / display "Name" style(header)=[background=cx00B050 foreground=white];
define Address / display "Address" style(header)=[background=cx00B050 foreground=white];
define Product / display "Product" style(header)=[background=cxFF0000 foreground=white];
define Value / display "Value" style(header)=[background=cxFF0000 foreground=white];
define Quantity / display "Quantity" style(header)=[background=cxFF0000 foreground=white];
RUN;
It gives the following result:
What I am trying to do is for the group headers to have the same colour as the column headers as follows:
Is that possible?
Thanks in advance.
Perhaps this will work for you
Perhaps this will work for you
ODS Escapechar can be used to apply specific colors in headers.
In this specific example I used ods rtf as an output file.
ods escapechar='~';
ods rtf file='test.rtf';
PROC REPORT DATA=have;
COLUMN ("~S={backgroundcolor=cx00B050 foreground=white}Customer Information" (CUSTID Name Address) )("~S={backgroundcolor=cxFF0000 foreground=white}Sales Information" (Product Value Quantity));
define CUSTID / display "CUSTID" style(header)=[background=cx00B050 foreground=white];
define Name / display "Name" style(header)=[background=cx00B050 foreground=white];
define Address / display "Address" style(header)=[background=cx00B050 foreground=white];
define Product / display "Product" style(header)=[background=cxFF0000 foreground=white];
define Value / display "Value" style(header)=[background=cxFF0000 foreground=white];
define Quantity / display "Quantity" style(header)=[background=cxFF0000 foreground=white];
RUN;
ods rtf close;
Dive into keynotes, announcements and breakthroughs on demand.
Explore Now →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.
Ready to level-up your skills? Choose your own adventure.