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

Hi All,

I want to keep below header as different colour and then export to excel file with ods tagset.excelxp option . How to proceed with this. In the same sheet, I want add data from abc and bcd dataset as separate sheet ( One single excel workbook contain 3 sheets like test, abc and bcd)

Demography -->orange

concomitant---> green

Adverse Event--> blue

headerheader

 

data test;
input pid age gender race drug1 $ drug2 $ event1 $ event2 $;
cards;
101 21 1 1 parac oflox diarr fever
102 21 2 1 dig oflox heada fever
103 31 1 1 nim oflox heada fever
104 43 2 1 dig oflox heada fever
 ;
run;

data abc;
set sashelp.class;
run;
data bcd;
set sashelp.heart;
run; proc report data=test out=test1; columns ('Summary data' ('Demography'pid age) ('concomitant'race gender drug1 drug2) ('Adverse Event'event1 event2)); run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Try Traffic Light.

 

data test;
input pid age gender race drug1 $ drug2 $ event1 $ event2 $;
cards;
101 21 1 1 parac oflox diarr fever
102 21 2 1 dig oflox heada fever
103 31 1 1 nim oflox heada fever
104 43 2 1 dig oflox heada fever
 ;
run;

proc format;
value $ fmt
"Summary data"="red"
"Demography"="orange"
"concomitant"="green"
"Adverse Event"="blue"
;
run;


ods tagsets.excelxp file='c:\temp\want.xls' style=htmlblue ;
proc report data=test nowd  style(header)={background=$fmt.};
columns 
('Summary data' 
('Demography' pid age) 
('concomitant' race gender drug1 drug2) 
("Adverse Event" event1 event2) 
);
define pid/display ;
run;
ods tagsets.excelxp close;

Ksharp_0-1647432262978.png

 

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Great example of where looking at the documentation has the answer:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/proc/p0xcdcilo2yuuwn1t9uks2c1e66e.htm

 

If I may be so bold as to make a recommendation for improvement — use a lighter color blue, this makes the black text of the words Adverse Event easier to read. 

--
Paige Miller
Ksharp
Super User

Try Traffic Light.

 

data test;
input pid age gender race drug1 $ drug2 $ event1 $ event2 $;
cards;
101 21 1 1 parac oflox diarr fever
102 21 2 1 dig oflox heada fever
103 31 1 1 nim oflox heada fever
104 43 2 1 dig oflox heada fever
 ;
run;

proc format;
value $ fmt
"Summary data"="red"
"Demography"="orange"
"concomitant"="green"
"Adverse Event"="blue"
;
run;


ods tagsets.excelxp file='c:\temp\want.xls' style=htmlblue ;
proc report data=test nowd  style(header)={background=$fmt.};
columns 
('Summary data' 
('Demography' pid age) 
('concomitant' race gender drug1 drug2) 
("Adverse Event" event1 event2) 
);
define pid/display ;
run;
ods tagsets.excelxp close;

Ksharp_0-1647432262978.png

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 872 views
  • 1 like
  • 3 in conversation