Hello Experts,
I'm wondering how to change the color on yellow for 2 last columns with proc tabulate :
My code is :
data shoes;
set sashelp.shoes (obs=20);
run;
ods excel file = "\\XXXXX\mon_fichier_2.xlsx"
options(start_at = "2,2"
embedded_titles = "on"
embed_footnotes_once = "on"
autofilter = "1-9"
frozen_headers = "on"
frozen_rowheaders = "2"
absolute_column_width = "15,15,15,15,15,15,15,15,15,15"
row_heights = "15,15,15,15,15,15"
sheet_name = "Tableau"
tab_color = "yellow")
style=Listing;
proc tabulate data=shoes;
title "Question";
class region product Subsidiary;
table (Product ALL ='TOTAL1'), (product ALL='TOTAL2')(Subsidiary ALL='TOTAL3');
keylabel n=' ';
run;
ods excel close;
How can I change also the grey color ?
Thank you ror your help !
You really should show ALL the code.
Consider:
proc tabulate data=sashelp.shoes(obs=20); title "Question"; class region product; class Subsidiary/style=[background=lightgreen]; Classlev Subsidiary / style= [background=lightgreen]; table (Product ALL ='TOTAL1'), (product ALL='TOTAL2')(Subsidiary ALL=[label='Total 3' style=[background=lightgreen]] ); keylabel n=' '; run;
CLASSLEV assigns properties to the levels, i.e. values of a class variable. If you want to change the CLASS variable appearance that can go on a CLASS statement or an override.
ALL is not a value of the class variable so needs to be addressed separately in overrides.
You really should show ALL the code.
Consider:
proc tabulate data=sashelp.shoes(obs=20); title "Question"; class region product; class Subsidiary/style=[background=lightgreen]; Classlev Subsidiary / style= [background=lightgreen]; table (Product ALL ='TOTAL1'), (product ALL='TOTAL2')(Subsidiary ALL=[label='Total 3' style=[background=lightgreen]] ); keylabel n=' '; run;
CLASSLEV assigns properties to the levels, i.e. values of a class variable. If you want to change the CLASS variable appearance that can go on a CLASS statement or an override.
ALL is not a value of the class variable so needs to be addressed separately in overrides.
The main differences between Proc Tabulate and Proc Report the way that I use them (others may see things differently) is that Proc Tabulate handles nesting in both row and column dimensions with multiple variables a bit "nicer" and allows multiple table statements in a single procedure call. Proc Report has more control over some things calculated in the procedure like break line summaries, calculations between result columns and compute blocks can conditionally assign appearance a bit more flexibly, with additional concerns, than Tabulate.
Which to use depends on what you need.
@SASdevAnneMarie wrote:
Thank you, ballardw. Last question: do you know please some option to change the grey color ?
The "grey color" where? The thing I find most challenging with some of these style elements is just finding the proper name to address them.
It may also help to mention which ODS Style you are using as a default or the the ODS destination as some of them default to different styles than the session setting.
For example I have my SAS sessions set to use the style MEADOW. Which has almost no grey anywhere.
I suggest you have a look at the ODS Style Gallery and pick the one that suits you best. Which style you choose also depends on the ODS destination you are using.
Also have a look at the SAS Note https://support.sas.com/techsup/notes/v8/36/900.html it provides a program that will show you some output created with all the styles, open the frame.html to view them all. The program will create a lot of files.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register 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.