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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 736 views
  • 1 like
  • 2 in conversation