Hi:
This is not really an ODS or Base Reporting procedure (PRINT, REPORT, TABULATE) question. Although, 5 could be done by any of the above procedures; report 6 probably is best done with PROC REPORT.
You can either create your fields as part of the merge that creates table 3 or in a separate query, after table 3 is created.
Then, once that you have table 3, you can work on the report tasks 5 . Here's an example of a few reports using sashelp.shoes:
[pre]
ods listing;
proc print data=sashelp.shoes noobs n;
title '5) Detail Listing with Sum';
by region;
var region product sales;
sum sales;
run;
proc tabulate data=sashelp.shoes f=8.2;
title '5) Summary Report with Grand Total and Percents';
class region product;
var sales returns;
table region all, n pctn;
table product all, n pctn;
table region all, sales* (n pctn sum*f=comma12. pctsum);
table product all, sales* (n pctn sum*f=comma12. pctsum);
run;
[/pre]
#6 doesn't exactly look like a report -- but maybe it is. It looks like you only want the calculation to be done on the 0/1 field that you set in b. Here's a possible solution using a DATA step and PROC REPORT:
[pre]
data calcvar;
set sashelp.shoes;
where product in ('Slipper', 'Sandal', 'Boot');
if product = 'Slipper' then numvar = 0;
else if product = 'Boot' then numvar = 0;
else numvar = 1;
run;
proc report data=calcvar nowd;
title '6) One Possible Solution';
where product in ('Slipper', 'Sandal', 'Boot');
column region product sales inventory numvar ;
define region / group;
define product / group;
define sales / sum;
define inventory / sum;
define numvar / sum;
break after region / summarize skip;
compute after region;
divnum = numvar.sum / .24;
line 'The number is: ' divnum comma8.2;
endcomp;
run;
[/pre]
For further help, you might consider looking at the SAS documentation or contacting Tech Support.
cynthia