SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sas_student1
Quartz | Level 8

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!

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

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;

View solution in original post

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

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;

sas_student1
Quartz | Level 8

@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;
sas_student1
Quartz | Level 8

@ChrisNZ 

That worked!!! Whoot whoot! You rock!!

Thank you!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 4 replies
  • 1819 views
  • 2 likes
  • 2 in conversation