Hi:
There is actually no need for the PROC SQL step in your code. PROC REPORT, using a COMPUTE block, can calculate a value for a row total, as shown in the example below. The program creates 2 report items CALCTOT1 and CALCTOT2, based on the use of the SALES, INVENTORY and RETURNS variables from SASHELP.SHOES. I just made up some formulas, although a simple SUM function would work as well.
cynthia
[pre]
ods html file='c:\temp\calc_row_tot.html' style=sasweb;
proc report data=sashelp.shoes nowd;
title 'Method 1 - Create a computed column with a calculation';
where region in ('Asia', 'Canada', 'Pacific');
column region product sales inventory returns calctot1 calctot2;
define region / group;
define product / group;
define sales / sum 'Sales';
define inventory / sum 'Inventory';
define returns / sum 'Returns';
define calctot1 /computed 'Sales + Inventory/minus Returns' f=dollar12.;
define calctot2 / computed 'Some other formula';
compute calctot1;
calctot1 = sum(sales.sum, inventory.sum, (-1*returns.sum));
endcomp;
compute calctot2;
calctot2 = (sum(sales.sum, inventory.sum, returns.sum) / 100) * .05;
endcomp;
rbreak after / summarize;
break after region / summarize;
compute after region;
line ' ';
endcomp;
run;
ods html close;
[/pre]