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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

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