BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I have an Excel spreadsheet being generated through ExcelXP and I am using a tagattr option within the body of the table (percent formatting). Additionally, I would like to add a background color for one particular variable but not for the other (I'm using a custom format, as can be seen in the classlev statements). Can I use both style options together, or will the tagattr not allow me to add anything else? The tabulate code:

proc tabulate data = stuff;
class level actname eth frl / style=classlev2;
classlev level / style=classlev;
classlev eth frl / style=classlev2;
table (level = ' ' )*(actname = ' ' all='Subtotal'),
eth='Ethnicity'*(n='#'*f=5. pctn='%'*f=pctfmt6.*[style=[tagattr='Format: 0.0%']])
frl='FRL Status'*(n='#'*f=5. pctn='%'*f=pctfmt6.*[style=[tagattr='Format: 0.0%']])
/ row=float misstext='-' indent=0;
run;

In this case, I would like to add a background shading to the Ethnicity data to increase readability.

Possible or impossible?

Thanks!
4 REPLIES 4
David_SAS
SAS Employee
Elayne,

Just do:

[pre]
eth='Ethnicity'*(n='#'*f=5. pctn='%'*f=pctfmt6.*[style=[tagattr='Format: 0.0%' background=red]])
[/pre]

substituting the desired background color for red.

-- David Kelley, SAS
deleted_user
Not applicable
Wow, I can't believe I asked that...I think that's what happens after a morning of figuring out how to override the alignment options in ExcelXP until you realize there is no alignment option and you have to go through the Proc Template route. The glaringly obvious solutions have eluded me, apparently!

Actually, that brings another question: my titles are centered ('Ethnicity' and the corresponding values) and my data are centered, both through template options. The '#' and '%' signs are not, however. I'm mostly concerned about the '%' sign, though, since that tagattr option is already in there. What kind of style element could I put in my template to enable me to center the # and % column headers?

Thanks.
David_SAS
SAS Employee
Does this work for you?
[pre]
eth='Ethnicity'*(n=[label='#' just=c]*f=5. pctn=[label='%' just=c]*f=pctfmt6.*[style=[tagattr='Format: 0.0%']])
[/pre]

-- David Kelley, SAS
deleted_user
Not applicable
Sorry, I must have missed your reply!

No, it didn't. Excel gives me an "Unable to read file" error when I try to open it up.

ExcelXP is a very tricky little devil...

-------------------------

EDIT: I figured it out! KEYWORD statement with my custom format solved the issue. (edited 14:34 PM 5/21/07 by ElayneR)

Message was edited by: ElayneR

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1395 views
  • 0 likes
  • 2 in conversation