Hi:
-- 1a) You could either do it with BY group processing in PROC REPORT with the BY group info (REGION=ASIA) in a SAS title.
-- 1b) OR you could just use "regular" BY group processing with the BY information NOT in the title
-- 2) Or, you could use COMPUTE BEFORE _PAGE_
-- 3) Or you could use COMPUTE BEFORE [breakvar-name]
Each technique has advantages and disadvantages and destinations where the technique will work better than other destinations.
Here is are code samples that shows each technique. For more help with PROC REPORT syntax, you should look at the PROC REPORT documentation, the papers listed at the end of this FAQ topic
http://support.sas.com/faq/030/FAQ03036.html
or consider contacting Tech Support for more help.
cynthia
[pre]
** 1a) by group and #byval;
ods listing;
options nobyline nodate nonumber;
ods html file='c:\temp\report1a.html' style=egdefault;
proc report data=sashelp.shoes nowd
style(summary)=Header;
by region;
title '1a) Region = #byval(region)';
where region in ('Asia', 'Canada', 'Pacific', 'Western Europe');
column region product sales;
define region / group noprint;
define product / group;
define sales/ 'Sales';
break after region /summarize skip ul ol;
compute after region;
if region = 'Central America/Caribbean' then region = 'C Amer/Carib';
else if region = 'Western Europe' then region = 'W Eur';
else if region = 'Eastern Europe' then region = 'E Eur';
product = trim(region)|| ' SubTot';
endcomp;
run;
ods _all_ close;
options byline;
title;
** 2a) Use regular BY line with BY group processing;
ods listing;
ods html file='c:\temp\report1b.html' style=egdefault;
proc report data=sashelp.shoes nowd
style(summary)=Header;
by region;
title 'The Report 1b';
where region in ('Asia', 'Canada', 'Pacific', 'Western Europe');
column region product sales;
define region / group noprint;
define product / group;
define sales/ 'Sales';
break after region /summarize skip ul ol;
compute after region;
if region = 'Central America/Caribbean' then region = 'C Amer/Carib';
else if region = 'Western Europe' then region = 'W Eur';
else if region = 'Eastern Europe' then region = 'E Eur';
product = trim(region)|| ' SubTot';
endcomp;
run;
ods _all_ close;
** 3) compute before _page_ WITHOUT BY;
ods listing;
ods html file='c:\temp\report2b.html' style=egdefault;
proc report data=sashelp.shoes nowd
style(summary)=Header;
title 'The Report 3';
where region in ('Asia', 'Canada', 'Pacific', 'Western Europe');
column region product sales;
define region / group noprint;
define product / group;
define sales/ 'Sales';
break before region / ;
break after region /summarize skip ul ol page;
compute before _page_ / style={just=l};
line 'Region = ' Region $char25. ;
endcomp;
compute after region;
if region = 'Central America/Caribbean' then region = 'C Amer/Carib';
else if region = 'Western Europe' then region = 'W Eur';
else if region = 'Eastern Europe' then region = 'E Eur';
product = trim(region)|| ' SubTot';
endcomp;
run;
ods _all_ close;
** 3) compute before region;
ods listing;
ods html file='c:\temp\report3.html' style=egdefault;
proc report data=sashelp.shoes nowd
style(summary)=Header;
title 'The Report 3';
where region in ('Asia', 'Canada', 'Pacific', 'Western Europe');
column region product sales;
define region / group noprint;
define product / group;
define sales/ 'Sales';
break before region / ;
break after region /summarize skip ul ol;
compute before region / style={just=l};
line 'Region = ' Region $char25. ;
endcomp;
compute after region;
if region = 'Central America/Caribbean' then region = 'C Amer/Carib';
else if region = 'Western Europe' then region = 'W Eur';
else if region = 'Eastern Europe' then region = 'E Eur';
product = trim(region)|| ' SubTot';
endcomp;
run;
ods _all_ close;
[/pre]