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!

Ready to join fellow brilliant minds for the SAS Hackathon?

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