Hi:
You did not say what your report procedure of choice was or what your destination was. There are at least 3 different methods to do what you want. Without getting into the possibility of a custom table template or SAS Macro processing, the 3 methods below use PROC REPORT. However, the first method uses PROC REPORT and compute blocks and the second method uses PROC REPORT with a BY statement and TITLES to place that kind of identifying information above the table (in the Title); the third method uses PROC REPORT's COMPUTE BEFORE _PAGE_ capability to place the headers inside the boundary of the table area.
The second method will put every unique combination of Region and Subsidiary on a separate page -- which may or may not be what you want. In the first method, paging will depend on the destination -- which means that there are no "between group" page breaks. The third method will put every unique combination of Region and Subsidiary on a separate page, too. But in my example, the STARTPAGE=NO option will suppress the page breaks for RTF and PDF destinations.
cynthia
[pre]
*** the code;
ods listing close;
title;
proc sort data=sashelp.shoes out=shoes;
by region subsidiary;
where region in ('Asia', 'Canada', 'Pacific');
run;
** this method uses PROC REPORT compute blocks to place the headers;
** on the page based on their existence in the column statement;
** since they are NOPRINT variables, they can be used in the COMPUTE block;
ods rtf file='header_method1.rtf';
ods pdf file='header_method1.pdf';
ods html file='header_method1.html' style=sasweb;
proc report data=shoes nowd;
title '1) Custom Header Method1 -- with compute block';
column region subsidiary product sales returns inventory;
define region /group noprint;
define subsidiary /group noprint;
define product /order ;
define sales / sum ;
define returns/ sum;
define inventory /sum;
break after subsidiary/summarize;
compute before region;
holdreg = Region;
endcomp;
compute before subsidiary /
style={just=l};
holdsub = Subsidiary;
line 'Region: ' holdreg $25.;
line 'Subsidiary: ' holdsub $25.;
endcomp;
compute after subsidiary;
line ' ';
endcomp;
run;
ods _all_ close;
** this method generates a page for every "group" and uses the TITLE statement;
** to place the "header" information;
** If you use startpage=no for RTF and PDF with this method, you will only keep;
** the title for the first table on the page -- which may not be what you want;
ods rtf file='header_method2.rtf';
ods pdf file='header_method2.pdf';
ods html file='header_method2.html' style=sasweb;
options nobyline nocenter;
title j=l 'Region: #byval(region)';
title2 j=l 'Subsidiary: #byval(subsidiary)';
proc report data=shoes nowd;
by region subsidiary;
column region subsidiary product sales returns inventory;
define region /group noprint;
define subsidiary /group noprint;
define product /order ;
define sales / sum ;
define returns/ sum;
define inventory /sum;
break after subsidiary / summarize;
run;
ods _all_ close;
options byline center;
title;
** this method uses a variation of Method 1 but has some of the benefits of ;
** Method2 -- in that you can get every table on a page or not -- your choice.;
** It uses the page option on the BREAK statement and then a;
** COMPUTE before _PAGE_ to place the text above the columns;
** the startpage=no option for RTF and PDF places multiple tables on a page;
** if you want every table on a separate page, then delete the "startpage=no" option.;
ods rtf file='header_method3.rtf' startpage=no;
ods pdf file='header_method3.pdf' startpage=no;
ods html file='header_method3.html' style=sasweb;
proc report data=shoes nowd;
title '3) Custom Header Method3 -- with compute block before _page_';
column region subsidiary product sales returns inventory;
define region /group noprint;
define subsidiary /group noprint;
define product /order ;
define sales / sum ;
define returns/ sum;
define inventory /sum;
break after subsidiary/summarize page;
compute before region;
holdreg = Region;
endcomp;
compute before _page_ /
style={just=l font_weight=bold foreground=black};
holdsub = Subsidiary;
line 'Region: ' holdreg $25.;
line 'Subsidiary: ' holdsub $25.;
endcomp;
run;
ods _all_ close;
[/pre]