More than Ten Footnotes

Updated: 28 Sep 2011

Introduction

It is common for reporting systems to need to deal with more than the ten footnotes sas will allow and this can be achieved using "compute blocks" in proc report. The Spectre reporting macros %npcttab and %unistats allow you to do this as well and you can say whether you want a line drawn before these and then you can list up to 15 footnotes manually or call an in-house macro to do this and then you can have more than 15 footnotes. Both %npcttab abd %unistats have identically named parameters to do this and they work in an identical way (all the code was copied from %unistats into %npcttab) so just %npcttab examples will be shown but the same applies to %unistats.

Pageline= and Endline= parameters

First of all I would like to make it clear that you do not have to use these parameters. If ten footnotes is enough for you and you do it the normal way using FOOTNOTE1 etc. then there is no problem. But if you need more than ten footnotes or your current system already uses "compute blocks" to do your footnotes then this is for you.

There is a pageline= parameter you set to "yes" or "no" (no quotes) to say if you want a line drawing above the footnotes and parameters pageline1-pageline15 where you supply quoted text that you want displaying as footnotes. There is also a pagemacro= parameter that you can use instead of pageline1-pageline15 and you set this to the name of the macro you use to create footnotes in compute blocks. Whatever code this macro calls, either directly or indirectly, must not have any data step or procedure boundaries in it and what it should produce is syntactically correct code for proc report compute block processing.

There are "endline" equivalents of the "pageline" parameters and these are for when you just want to show footnotes at the end of a report and not on ever page. These parameters are named endline=, endline1-endline15 and endmacro= as you would expect. Only the "pageline" parameters will be demonstrated on this page but the same applies to "endline" parameters.

Normal use of the pageline parameters

/* Demonstrate %npcttab: program 1 */ 
options noovp nodate nonumber center 
missing=" " formchar='|_---|+|---+=|-/\<>*'; 

options sasautos=("C:\spectre\macros" SASAUTOS); 

options ls=78 ps=63; 

title1; 

proc format; 
  value racecd 
  1="CAUCASIAN" 
  2="BLACK" 
  3="ASIAN" 
  4="HISPANIC" 
  5="OTHER" 
  ; 
  value sexcd 
  1="MALE" 
  2="FEMALE" 
  ; 
  value trtcd  
  1="Ambident (1g/day)"  
  2="Betamax (500mg/day)"  
  3="No treatment"  
  ;  
  value trtnarr  
  1="Ambident@(1g/day)"  
  2="Betamax@(500mg/day)"  
  3="No@treatment"  
  ; 
  value NY 
  0="NO" 
  1="YES" 
  ; 
run; 
 

proc sort data=sasuser.demog(where=(fascd=1)) 
           out=demog(drop=fascd); 
  by patno invid; 
run; 

%popfmt(demog,trtcd,uniqueid=patno invid) 

proc sort data=sasuser.adv 
           out=adv; 
  by patno invid; 
run; 

data adv; 
  merge demog(in=_dem keep=patno invid trtcd) adv(in=_adv); 
  by patno invid; 
  if _dem and _adv; 
run; 

%npcttab(dsin=adv,midlvl=amsoc,lowlvl=ampt,
pageline=yes,pageline1="This is the first page line",pageline2="This is the second page line");
 

Here is the report with the pageline drawn and the two footnotes.
 
______________________________________________________________________________

                       Ambident (1g/day)    Betamax (500mg/day)       Total
                             (N=9)                 (N=8)             (N=17)
______________________________________________________________________________

Gastrointestinal disorders
   ANY AE                   7 ( 77.8)             8 (100.0)         15 ( 88.2)
   Constipation             4 ( 44.4)             5 ( 62.5)          9 ( 52.9)
   Nausea                   3 ( 33.3)             6 ( 75.0)          9 ( 52.9)
   Abdominal pain NOS       2 ( 22.2)             6 ( 75.0)          8 ( 47.1)
   Diarrhoea NOS            2 ( 22.2)             6 ( 75.0)          8 ( 47.1)
   Vomiting NOS             2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

General disorders and administration site conditions
   ANY AE                   6 ( 66.7)             5 ( 62.5)         11 ( 64.7)
   Chest pain               5 ( 55.6)             4 ( 50.0)          9 ( 52.9)
   Pain NOS                 2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

Psychiatric disorders
   ANY AE                   4 ( 44.4)             7 ( 87.5)         11 ( 64.7)
   Insomnia                 4 ( 44.4)             7 ( 87.5)         11 ( 64.7)
   Anxiety                  2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

Musculoskeletal and connective tissue disorders
   ANY AE                   4 ( 44.4)             6 ( 75.0)         10 ( 58.8)
   Pain in extremity        3 ( 33.3)             5 ( 62.5)          8 ( 47.1)
   Back pain                3 ( 33.3)             4 ( 50.0)          7 ( 41.2)

Respiratory, thoracic and mediastinal disorders
   ANY AE                   5 ( 55.6)             5 ( 62.5)         10 ( 58.8)
   Cough                    4 ( 44.4)             4 ( 50.0)          8 ( 47.1)
   Dyspnoea                 3 ( 33.3)             3 ( 37.5)          6 ( 35.3)

Vascular disorders
   ANY AE                   5 ( 55.6)             5 ( 62.5)         10 ( 58.8)
   Hypotension NOS          4 ( 44.4)             5 ( 62.5)          9 ( 52.9)
   Hypertension NOS         2 ( 22.2)             2 ( 25.0)          4 ( 23.5)

Nervous system disorders
   ANY AE                   2 ( 22.2)             5 ( 62.5)          7 ( 41.2)
   Headache                 2 ( 22.2)             5 ( 62.5)          7 ( 41.2)
   Tremor                   2 ( 22.2)             2 ( 25.0)          4 ( 23.5)

______________________________________________________________________________
This is the first page line
This is the second page line
 

If the above report was two pages long or the page size small then you would get footnotes on each page but it might not break the page in a good place. Here is the same output again with a page size of 30 and rerun.
 
options ps=30;
%npcttab(dsin=adv,midlvl=amsoc,lowlvl=ampt,
pageline=yes,pageline1="This is the first page line",pageline2="This is the second page line");

You can see that the report has thrown a page at a bad place because it has split one of the groups.
 
______________________________________________________________________________

                       Ambident (1g/day)    Betamax (500mg/day)       Total
                             (N=9)                 (N=8)             (N=17)
______________________________________________________________________________

Gastrointestinal disorders
   ANY AE                   7 ( 77.8)             8 (100.0)         15 ( 88.2)
   Constipation             4 ( 44.4)             5 ( 62.5)          9 ( 52.9)
   Nausea                   3 ( 33.3)             6 ( 75.0)          9 ( 52.9)
   Abdominal pain NOS       2 ( 22.2)             6 ( 75.0)          8 ( 47.1)
   Diarrhoea NOS            2 ( 22.2)             6 ( 75.0)          8 ( 47.1)
   Vomiting NOS             2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

General disorders and administration site conditions
   ANY AE                   6 ( 66.7)             5 ( 62.5)         11 ( 64.7)
   Chest pain               5 ( 55.6)             4 ( 50.0)          9 ( 52.9)
   Pain NOS                 2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

Psychiatric disorders
   ANY AE                   4 ( 44.4)             7 ( 87.5)         11 ( 64.7)
   Insomnia                 4 ( 44.4)             7 ( 87.5)         11 ( 64.7)
   Anxiety                  2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

Musculoskeletal and connective tissue disorders
   ANY AE                   4 ( 44.4)             6 ( 75.0)         10 ( 58.8)
   Pain in extremity        3 ( 33.3)             5 ( 62.5)          8 ( 47.1)
______________________________________________________________________________
This is the first page line
This is the second page line

______________________________________________________________________________

                       Ambident (1g/day)    Betamax (500mg/day)       Total
                             (N=9)                 (N=8)             (N=17)
______________________________________________________________________________

   Back pain                3 ( 33.3)             4 ( 50.0)          7 ( 41.2)

Respiratory, thoracic and mediastinal disorders
   ANY AE                   5 ( 55.6)             5 ( 62.5)         10 ( 58.8)
   Cough                    4 ( 44.4)             4 ( 50.0)          8 ( 47.1)
   Dyspnoea                 3 ( 33.3)             3 ( 37.5)          6 ( 35.3)

Vascular disorders
   ANY AE                   5 ( 55.6)             5 ( 62.5)         10 ( 58.8)
   Hypotension NOS          4 ( 44.4)             5 ( 62.5)          9 ( 52.9)
   Hypertension NOS         2 ( 22.2)             2 ( 25.0)          4 ( 23.5)

Nervous system disorders
   ANY AE                   2 ( 22.2)             5 ( 62.5)          7 ( 41.2)
   Headache                 2 ( 22.2)             5 ( 62.5)          7 ( 41.2)
   Tremor                   2 ( 22.2)             2 ( 25.0)          4 ( 23.5)
 
 
 
 

______________________________________________________________________________
This is the first page line
This is the second page line

It is better to force a page throw using the pageon= parameter which is a list of text items in quotes separated by spaces of the beginning value of text of the highest level term to force a page throw. If I used pageon="Psych" "General" then I would get a three page report.
 
*- set page size back to original -;
options ps=63;
%npcttab(dsin=adv,midlvl=amsoc,lowlvl=ampt,pageon="Psych" "General",
pageline=yes,pageline1="This is the first page line",pageline2="This is the second page line");

 
______________________________________________________________________________

                       Ambident (1g/day)    Betamax (500mg/day)       Total
                             (N=9)                 (N=8)             (N=17)
______________________________________________________________________________

Gastrointestinal disorders
   ANY AE                   7 ( 77.8)             8 (100.0)         15 ( 88.2)
   Constipation             4 ( 44.4)             5 ( 62.5)          9 ( 52.9)
   Nausea                   3 ( 33.3)             6 ( 75.0)          9 ( 52.9)
   Abdominal pain NOS       2 ( 22.2)             6 ( 75.0)          8 ( 47.1)
   Diarrhoea NOS            2 ( 22.2)             6 ( 75.0)          8 ( 47.1)
   Vomiting NOS             2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

______________________________________________________________________________
This is the first page line
This is the second page line

______________________________________________________________________________

                       Ambident (1g/day)    Betamax (500mg/day)       Total
                             (N=9)                 (N=8)             (N=17)
______________________________________________________________________________

General disorders and administration site conditions
   ANY AE                   6 ( 66.7)             5 ( 62.5)         11 ( 64.7)
   Chest pain               5 ( 55.6)             4 ( 50.0)          9 ( 52.9)
   Pain NOS                 2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

______________________________________________________________________________
This is the first page line
This is the second page line

______________________________________________________________________________

                       Ambident (1g/day)    Betamax (500mg/day)       Total
                             (N=9)                 (N=8)             (N=17)
______________________________________________________________________________

Psychiatric disorders
   ANY AE                   4 ( 44.4)             7 ( 87.5)         11 ( 64.7)
   Insomnia                 4 ( 44.4)             7 ( 87.5)         11 ( 64.7)
   Anxiety                  2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

Musculoskeletal and connective tissue disorders
   ANY AE                   4 ( 44.4)             6 ( 75.0)         10 ( 58.8)
   Pain in extremity        3 ( 33.3)             5 ( 62.5)          8 ( 47.1)
   Back pain                3 ( 33.3)             4 ( 50.0)          7 ( 41.2)

Respiratory, thoracic and mediastinal disorders
   ANY AE                   5 ( 55.6)             5 ( 62.5)         10 ( 58.8)
   Cough                    4 ( 44.4)             4 ( 50.0)          8 ( 47.1)
   Dyspnoea                 3 ( 33.3)             3 ( 37.5)          6 ( 35.3)

Vascular disorders
   ANY AE                   5 ( 55.6)             5 ( 62.5)         10 ( 58.8)
   Hypotension NOS          4 ( 44.4)             5 ( 62.5)          9 ( 52.9)
   Hypertension NOS         2 ( 22.2)             2 ( 25.0)          4 ( 23.5)

Nervous system disorders
   ANY AE                   2 ( 22.2)             5 ( 62.5)          7 ( 41.2)
   Headache                 2 ( 22.2)             5 ( 62.5)          7 ( 41.2)
   Tremor                   2 ( 22.2)             2 ( 25.0)          4 ( 23.5)

______________________________________________________________________________
This is the first page line
This is the second page line

Use of pagemacro=

Use pagemacro= to tell it your footnotes macro if you need more that 15 footnotes. Your system might already work this way. Here I will define a macro that creates 18 footnotes. Remember that whatever this macro calls in its execution must not be code that contains a data step or procedure boundary and must produce syntax that is acceptable for use in a proc report compute block. This will probably be just "line" statements. There is also an endmacro= parameter when you want footnotes only at the end of the report rather than on every page.
 
%macro foot;
  %local i;
  %do i=1 %to 18;
    line @1 "Footnote line %sysfunc(putn(&i,words.))";
  %end;
%mend foot;

%npcttab(dsin=adv,midlvl=amsoc,lowlvl=ampt,pageon="Psych" "General",
pageline=yes,pagemacro=foot);

And here are the results.
 
______________________________________________________________________________

                       Ambident (1g/day)    Betamax (500mg/day)       Total
                             (N=9)                 (N=8)             (N=17)
______________________________________________________________________________

Gastrointestinal disorders
   ANY AE                   7 ( 77.8)             8 (100.0)         15 ( 88.2)
   Constipation             4 ( 44.4)             5 ( 62.5)          9 ( 52.9)
   Nausea                   3 ( 33.3)             6 ( 75.0)          9 ( 52.9)
   Abdominal pain NOS       2 ( 22.2)             6 ( 75.0)          8 ( 47.1)
   Diarrhoea NOS            2 ( 22.2)             6 ( 75.0)          8 ( 47.1)
   Vomiting NOS             2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

______________________________________________________________________________
Footnote line one
Footnote line two
Footnote line three
Footnote line four
Footnote line five
Footnote line six
Footnote line seven
Footnote line eight
Footnote line nine
Footnote line ten
Footnote line eleven
Footnote line twelve
Footnote line thirteen
Footnote line fourteen
Footnote line fifteen
Footnote line sixteen
Footnote line seventeen
Footnote line eighteen

______________________________________________________________________________

                       Ambident (1g/day)    Betamax (500mg/day)       Total
                             (N=9)                 (N=8)             (N=17)
______________________________________________________________________________

General disorders and administration site conditions
   ANY AE                   6 ( 66.7)             5 ( 62.5)         11 ( 64.7)
   Chest pain               5 ( 55.6)             4 ( 50.0)          9 ( 52.9)
   Pain NOS                 2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

______________________________________________________________________________
Footnote line one
Footnote line two
Footnote line three
Footnote line four
Footnote line five
Footnote line six
Footnote line seven
Footnote line eight
Footnote line nine
Footnote line ten
Footnote line eleven
Footnote line twelve
Footnote line thirteen
Footnote line fourteen
Footnote line fifteen
Footnote line sixteen
Footnote line seventeen
Footnote line eighteen

______________________________________________________________________________

                       Ambident (1g/day)    Betamax (500mg/day)       Total
                             (N=9)                 (N=8)             (N=17)
______________________________________________________________________________

Psychiatric disorders
   ANY AE                   4 ( 44.4)             7 ( 87.5)         11 ( 64.7)
   Insomnia                 4 ( 44.4)             7 ( 87.5)         11 ( 64.7)
   Anxiety                  2 ( 22.2)             3 ( 37.5)          5 ( 29.4)

Musculoskeletal and connective tissue disorders
   ANY AE                   4 ( 44.4)             6 ( 75.0)         10 ( 58.8)
   Pain in extremity        3 ( 33.3)             5 ( 62.5)          8 ( 47.1)
   Back pain                3 ( 33.3)             4 ( 50.0)          7 ( 41.2)

Respiratory, thoracic and mediastinal disorders
   ANY AE                   5 ( 55.6)             5 ( 62.5)         10 ( 58.8)
   Cough                    4 ( 44.4)             4 ( 50.0)          8 ( 47.1)
   Dyspnoea                 3 ( 33.3)             3 ( 37.5)          6 ( 35.3)

Vascular disorders
   ANY AE                   5 ( 55.6)             5 ( 62.5)         10 ( 58.8)
   Hypotension NOS          4 ( 44.4)             5 ( 62.5)          9 ( 52.9)
   Hypertension NOS         2 ( 22.2)             2 ( 25.0)          4 ( 23.5)

Nervous system disorders
   ANY AE                   2 ( 22.2)             5 ( 62.5)          7 ( 41.2)
   Headache                 2 ( 22.2)             5 ( 62.5)          7 ( 41.2)
   Tremor                   2 ( 22.2)             2 ( 25.0)          4 ( 23.5)

______________________________________________________________________________
Footnote line one
Footnote line two
Footnote line three
Footnote line four
Footnote line five
Footnote line six
Footnote line seven
Footnote line eight
Footnote line nine
Footnote line ten
Footnote line eleven
Footnote line twelve
Footnote line thirteen
Footnote line fourteen
Footnote line fifteen
Footnote line sixteen
Footnote line seventeen
Footnote line eighteen

Conclusion

You have seen how to have more than ten footnotes using %npcttab and %unistats by use of pageline= and endline= parameters and how to declare your standard foormotes macro to pagemacro= or endmacro= .
 
 
 

Use the "Back" button of your browser to return to the previous page.

contact the author