Hi:
In addition to Doc's suggestion, SAS has reporting procedures like PROC MEANS, PROC TABULATE and PROC REPORT that will produce summary reports (that would only show the subtotals and/or grand totals). PROC REPORT and PROC PRINT have the ability to create "detail" reports where the subtotals and grandtotals are added to the report as extra summary lines. (For purposes of explanation, a detail report contains one report row for every observation in your original dataset or subset, with additional summary lines added to the report; a summary report contains one report row for every summarized group of observations, with additional summary lines added to the report for subtotals and grand totals.)
Some SQL queries are used for reporting purposes, and if this is your goal, then you might investigate the SAS reporting procedures mentioned above (to name just a few).
cynthia