Left-aligning footnotes

Introduction

If you work in the field of clinical reporting, as I do, then for nearly every output you program, the titles are supposed to be centred and the footnotes left-aligned but there is no system option to give you this combination. If you specify "nocenter" then both titles and footnotes will be left-aligned and if you specify "center" then both titles and footnotes will be centered. Perhaps, in the future, SAS will change this but until then we will have to program around it by left-aligning the footnotes.

Adding spaces to footnotes

The way most programmers left-align footnotes, where they have to code this themselves, is to add spaces to the right of the footnote to make the footnote at least the linesize width, but they still have to be careful that they don't break the 262 character limit imposed by SAS. I will show you an example with a short footnote not causing a problem followed by a longer footnote that breaks the 262 character limit.
 
1    options center;
2    footnote1 "this is a short footnote %sysfunc(repeat(%str( ),230))";

3    options center;
4    footnote1 "this is a short footnote %sysfunc(repeat(%str( ),230))";
5    footnote2 "this is a longer footnote that will give a problem %sysfunc(repeat(%str( ),230))";
WARNING: The quoted string currently being processed has become more than 262 characters long.
         You may have unbalanced quotation marks.
 

Another method programmers use to left-align footnotes is to follow the footnote with a separate string of spaces in quotes on a following line such as shown below. However, it is important to make sure the spacing string is long enough to give alignment. So long as neither part of the footnote is greater than 262 characters then SAS will not complain. Here is the code.
 
data dummy;
dummy="dummy";
run;
options center linesize=145;
footnote1 "short footnote not long enough to left-align"
"                                                                                          ";
footnote2 "this is a longer footnote that will be correctly left-aligned due to its length"
"                                                                                          ";
proc print;
run;

Here are the footnotes at the bottom of the output. You will see the the first footnote is not left-aligned as the sum of its length and the length of the spacing string did not sum up to the linesize which is set at 145.
 

     short footnote not long enough to left-align
this is a longer footnote that will be correctly left-aligned due to its length
 

%lafootnote

The way to avoid the misalignment problem shown above and to keep within the 262 character limit is to pad out the footnote with a number of characters that will be greater than any linesize you will use and keep it less than 262 characters. 200 is a good number. This is where a macro comes in handy to do the work for you. I have such a macro called %lafootnote to do this which you can see at work below.
 
data dummy;
dummy="dummy";
run;
options center linesize=145;
%lafootnote(1,"short footnote");
%lafootnote(2,"this is a longer footnote that will be correctly left-aligned due to its length");
proc print;
run;

You will see below that both footnotes were left-aligned correctly.
 

short footnote
this is a longer footnote that will be correctly left-aligned due to its length
 

Take a look at the code that does this work inside the macro %lafootnote.

Other alignment macros

I have a number of macros to do alignment for me. Some work on titles, some on footnotes. You can link to these below.
%latitle
%lcralign
%lrafootnote
%lratitle
%rafootnote
%ratitle
 


 
 

Go back to the home page.

E-mail the macro and web site author.