How do i calculate new columns based on columns in a summary table. I.e I create a summary table which gives me exactly what i want and how i want to see the data. However i want to make a calculation based on two of the columns in the sumary table.
If i output the summary table as a data table the format of the data completly changes. The data table changes the summary table columns into rows.
The question is: what is your procedure of choice? What are you currently using to create the summary table?
If you are using PROC FREQ or PROC TABULATE or PROC MEANS to create your summary table, then the answer is NO, you cannot make a calculation based on summary columns unless you create an output dataset and then use that dataset within a program that does the calculation.
PROC REPORT can create cross-tabular reports too. The computations with ACROSS variables are do-able, but you need to use the "absolute" column names for the ACROSS vars, instead of the dataset name. That's because each report column that comes from an ACROSS usage gets a unique number of its own. The second document above shows an example of doing this.
ods html file='c:\temp\compute_examp.html' style=sasweb;
proc report data=sashelp.prdsale nowd;
column division prodtype n actual predict diff;
define division / group;
define prodtype / group;
define actual / sum;
define predict / sum;
define n / 'Count of Sales';
define diff / computed f=dollar8.;
rbreak after / summarize;
diff = actual.sum - predict.sum;
ods html close;