@MelissaM wrote:
@ballardw Appreciate the reply, and suggestions.
Yes, I was seeking SUBGROUP TOTALS (30 for each table).
Which I did in the first row of each table.
Why specifically FOOTNOTES? If find having to look for such in a different location than the summary table to be distracting.
What ODS destination do you want/expect to use? Footnotes in some destinations will be at the bottom of a page, not following the table(s) and quite likely would only show the last footnote before the page was created. Or do you want a bunch of small tables each appearing on a different page of a document?
This does what you request:
%macro maketabulate ();
proc sql noprint;
select group, count(*) into : groupid1-, : groupcount1-
from customer_response
group by group
;
quit;
%let Numgroups = &sqlobs;
%do i = 1 %to &numgroups;
title 'Customer Survey Results: Spring 1996';
title3 'Factors Influencing the Decision to Buy';
footnote "Number of Respondents: &&groupcount&i.";
proc tabulate data=customer_response;
by group;
Where group= &&groupid&i;
var factor1-factor4 customer;
table (factor1='Cost'
factor2='Performance'
factor3='Reliability'
factor4='Sales Staff'),
(n='Count'*f=7. pctn<customer>='Percent'*f=pctfmt9.) ;
run;
%end;
%mend;
%maketabulate()
title; footnote;
The proc sql generates the different macro variables you needed for the footnote, and optionally one you could use in a matching title statement instead of using "BY" to get a group label.
Caution: use of Indirect macro referencing, those with the && (or more) can be quite difficult to debug and modify with a strong understanding of the macro language.
Note that this can be a very inefficient process if the data set is large because the use of Footnote forces rereading the source data set once for each value of Group variable.
Also, since you have not stated the ODS destination keep in mind the warning about Footnote and some destinations.
... View more