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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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