BookmarkSubscribeRSS Feed
steve_citi
Calcite | Level 5
I would like the color for the ALL keyword to extend across all of the columns.

I've checked some documentation and it would appear that my syntax is correct.
However, it is only highlighting the word "SubTotal"., and not expanding across.

Can anyone see where my syntax is wrong? Or missing something?


proc tabulate data=&period.level missing;
class product1 product_raw;
class &periodvar. / descending;
var &balvar. ;
tables
(product1=''*(product_raw=' ' ALL='SubTotal') ALL='All Products')*[style=],
(&periodvar.="Calendar &period.")*
(&balvar.=''*sum ='Outstanding Avg. $MM' *f=mmfmt. *[style=[tagattr='Format:$###,###,###,###.00;[Red][<0]$-###,###,###,###.00']])
/ box="Product" rtspace=25 row=float;
KEYWORD ALL / s=[font_weight=bold font_face=times font_size=1 background=liypk];
8 REPLIES 8
steve_citi
Calcite | Level 5
This line did not get in the original posting:


/ box="Product" rtspace=25 row=float;
KEYWORD ALL / s=[font_weight=bold font_face=times font_size=1 background=liypk];
Cynthia_sas
SAS Super FREQ
Hi:
Sometimes when you use < or > in your code, the forum posting mechanism sees those characters as HTML delimiting tags and some of your post gets truncated or scrambled. if you use &lt; and &gt; instead of < and > when you post code, your code won't get truncated.

At any rate, helpful to know would be the destination of interest and which ALL you want to have impacted by your style -- the ALL that's labelled 'SubTotal' or the ALL that's labelled 'All Products'.

The simplified code below may help you figure out what's going wrong. I prefer to use { and } instead of [ and ] because they are easier to distinguish in statements that also have parentheses.

Also, I took out the RTSPACE option, since it has no impact on destinations other than the LISTING destination and your use of STYLE overrides implies that you are using ODS destinations.

cynthia
[pre]
ods tagsets.excelxp file='c:\temp\parent_style.xls' style=sasweb;
ods html file='c:\temp\parent_style.html' style=sasweb;

proc tabulate data=sashelp.prdsale missing;
title '1) Style=<parent>';
class region division;
class product / descending;
var actual ;
tables
(region=''*(division=' ' ALL='SubTotal'*{style=<parent>})) ALL='All Products'*{style=<parent>},
(product="Product")*(actual=''*sum ='Actual')
/ box="Box Text" row=float ;
KEYWORD ALL /
s=[font_weight=bold font_face=Times font_size=1 background=liypk];
run;

ods _all_ close;
[/pre]
steve_citi
Calcite | Level 5
Hi Cynthia,

Thanks for your reply. The ALL that I am interested in is the "SubTotal" ALL.

I think my code and yours are logically equivalent.

I have the *[style=] in the same place as your code, after the definition of the first dimension.

Is there something else missing? It will only highlight the word "SubTotal".
Cynthia_sas
SAS Super FREQ
Hi,
Have you actually run my code???? My whole row gets the color changed. In fact, there are differences in the placement of parentheses in our two TABLE statements in in the placement of the style=<parent> syntax.
[pre]
My TABLE statement:

tables
(region=''*(division=' ' ALL='SubTotal'*{style=<parent>})) ALL='All Products'*{style=<parent>},
(product="Product")*(actual=''*sum ='Actual')
/ box="Box Text" row=float ;
KEYWORD ALL /
s=[font_weight=bold font_face=Times font_size=1 background=liypk];

Your TABLE statement:

tables
(product1=''*(product_raw=' ' ALL='SubTotal') ALL='All Products')*[style=<parent>],
(&periodvar.="Calendar &period.")*
(&balvar.=''*sum ='Outstanding Avg. $MM' *f=mmfmt. *[style=[tagattr='Format:$###,###,###,###.00;[Red][<0]]]]

/ box="Product" rtspace=25 row=float;
KEYWORD ALL / s=[font_weight=bold font_face=times font_size=1 background=liypk];
[/pre]

So, I would recommend starting with MY code, making sure that the highlighting is being done correctly, and then changing your code accordingly.

cynthia
steve_citi
Calcite | Level 5
Cynthia,

I executed your code and it does produce the desired results.

I have modified my code as well to match yours.

However, for some reason it is still not working.

proc tabulate data=&period.level missing;
class product1 product_raw;
class &periodvar. descending;
var &balvar. ;
tables (product1=' ' *(product_raw=' ' ALL='SubTotal'*{style=}))
ALL='All Products'*{style=},
(&periodvar.="Calendar &period.")*
(&balvar.=''*sum ='Outstanding Avg. $MM' *f=mmfmt.
*[style=[tagattr='Format:$###,###,###,###.00;[Red][<0]$-
###,###,###,###.00']])
/ box="Product" rtspace=25 row=float;
KEYWORD ALL / s=[font_weight=bold font_face=times font_size=1 background=liypk];
Cynthia_sas
SAS Super FREQ
Hi:
Well, the one difference is that you have a *[style=[...]] in your COLUMN dimension and I do not have that in my TABLE statement. I'd suggest either:
1) taking out the style= override in the COL dimension or
2) putting
[pre]/ style_precedence=row ;[/pre]

in your TABLE statement options.

The default order of precedence is that the column dimension style and column dimension format "win" over the row dim style and row dim format.

cynthia
steve_citi
Calcite | Level 5
Cynthia,

Sorry for being so dense.....but where do you see me using a parent for my column dimension?

I have 2 style= references.......same as you.
Cynthia_sas
SAS Super FREQ
The STYLE for TAGATTR in the COLUMN dimension might be overriding the STYLE=<PARENT> in the ROW dimension.

Even though you do not explicitly have STYLE=<PARENT> in the COL dimension, you have -some- style attribute override and PROC TABULATE is very touchy about deciding which style attribute to use. If you remove the TAGATTR override and it works, then you know why. If you use style_precedence=row, you could very well get the color you want without the TAGATTR being used. But first, if the color is more important, you need to get that working.

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 8 replies
  • 1278 views
  • 0 likes
  • 2 in conversation