Hello,
I am running a proc report that I am exporting to excel.
I want to be able to put a footnote at the end of the excel sheet on a condition in the table. That is, if a clinic has a certain characteristic e.g. if a clinic has an ID that has an "A", then put an asterisk (*) next to the cell and put a footnote with the asterisk at the end of the excel table.
Below is the SAS code that I have written out which works with what I need, except figuring out the footnote.
Any ideas on what I would need to add to the code below?
ods excel file ='C:\Excel_table.xlsx';
ods escapechar ='^';
ODS excel options(Embedded_Titles ='yes' sheet_name='New Cases');
title1 j=l h=11pt color=black font=Calibri bold
"^{style[fontweight=bold]
Summary of ^{style[fontstyle=italic] New} Cases by clinic}";
title2 j=l h=11pt color=black font=Calibri
"^{style[fontweight=bold]Date Complete: ^{style[color=blue fontstyle=italic]%sysfunc(date(),worddate18.)}}";
proc report data=have
style(header)=[background=darkmagenta color=white font_face='Calibri' fontsize=11pt fontweight=bold]
style(column)={font_face='Calibri' fontsize=11pt};
column clinic new_patients new_cases;
define clinic / group;
define new_patients / sum;
define new_cases / sum;
/*break after Program_Name / summarize style={background=lightgrey};*/
rbreak after / summarize style=Header;
Compute after;
clinic ='GRAND TOTAL';
endcomp;
run;
Thank you in advance!
I don't see where you add your asterisk, but this should do what you want.
Run something like this before the proc report:
data _null_;
set HAVE;
if index(ID,'A') then do;
call execute('footnote "* This cell contains an ''A'' ";');
stop;
end;
run;
I don't see where you add your asterisk, but this should do what you want.
Run something like this before the proc report:
data _null_;
set HAVE;
if index(ID,'A') then do;
call execute('footnote "* This cell contains an ''A'' ";');
stop;
end;
run;
@ChrisNZ Thank you!
This is exactly what I needed!
I tweaked the code so it would left justify and change the font. A follow-up how do I change the font size of the footnote? I tried fontsize=11pt or font=11pt but that didnt work.
data _null_;
set have ;
if index(client,'*') then do;
call execute
('footnote justify=left font=Calibri color=black bold "* Multiple clients are reported here";');
stop;
end;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: