BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASdevAnneMarie
Barite | Level 11

Hello Experts,

 

I'm wondering how to change the color on yellow for 2 last columns with proc tabulate :

MarieT_0-1625825511550.png

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 !

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

10 REPLIES 10
BrunoMueller
SAS Super FREQ
Have a look here in the doc to see how various elements can be colored
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0e7wgyk6rm3ppn1pny8b38napm3.htm

Or choose a different style.
SASdevAnneMarie
Barite | Level 11
Thank you, Bruno,
I put the color on "Abab", "Algiers" and "Cairo" with : Classlev Subsidiary / style= [background=lightgreen];
But still can't color "Subsidiary" end "TOTAL3".

Thank your for your help !
ballardw
Super User

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.

SASdevAnneMarie
Barite | Level 11
Thank you Ballardw !
What is the difference between proc report and proc tabulate.
Maybe the proc report is better to use?
ballardw
Super User

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
Barite | Level 11
Thank you, ballardw. Last question: do you know please some option to change the grey color ?
ballardw
Super User

@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.

 

 

 

SASdevAnneMarie
Barite | Level 11
Thank you, Ballardw. My ods style is style=Listing. I would like to change the color for blue, by default.
BrunoMueller
SAS Super FREQ

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.

SASdevAnneMarie
Barite | Level 11
Thank you, Bruno !

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 10 replies
  • 2058 views
  • 7 likes
  • 3 in conversation