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
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;
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;
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.
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;
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!
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.