BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Rydhm
Obsidian | Level 7

I am trying to output SAS DS with multiple columns into excel and want to show two columns' name/label with two different colors. Please see the expected example output below:

Capture.PNG

So I need both black and red colors in one cell label. I have done this for the cell rows using ^{style option but same doesn't work for labels.

Sample code:

data test;
input lab s1 $ s2 $;
datalines;
1 A1 A2
2 B1 B2
3 C1 C2
;
run;

proc report data=test nowindows missing
style(column)=[foreground=black background=WHITE font_face=arial font_size=10pt just=center ]
style(header)=[foreground=black background=white font_face=arial font_size=10pt just=center fontweight=bold];
column lab s1 s2;

define lab/"Lab Number" center;
define s1/"sample 1 (Use this on Primary page)" center;
define s2/"sample 2 (Use this on Secondary page)" center;
run;

Please suggest how this can be done?
Thank You.

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:
You do not show how you are getting the output into Excel. What is your ODS destination? Can you share the rest of your code?
Cynthia

 

Just as an example using ODS ESCAPECHAR functions for the style override with ODS EXCEL worked for me, as shown below (my changes to your code are shown in yellow):

Cynthia_sas_0-1683224283708.png

 

View solution in original post

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:
You do not show how you are getting the output into Excel. What is your ODS destination? Can you share the rest of your code?
Cynthia

 

Just as an example using ODS ESCAPECHAR functions for the style override with ODS EXCEL worked for me, as shown below (my changes to your code are shown in yellow):

Cynthia_sas_0-1683224283708.png

 

Rydhm
Obsidian | Level 7
This is great, thank you so much Cynthia. It worked perfectly. Sorry I forgot to mention the ods. I am using ods excel.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 245 views
  • 1 like
  • 2 in conversation