the sum of each month's sales, and then uses the SUM function a second time to total the
monthly sums into one grand total.
sum(calculated JanTotal, calculated FebTotal,
calculated MarTotal) as GrandTotal format=dollar10.
An alternative way to code the grand total calculation is to use nested functions:
sum(sum(January), sum(February), sum(March))
as GrandTotal format=dollar10.
Creating a Summary Report
You have a table that contains detailed sales information. You want to produce a
summary report from the detail table.
There is one input table, called Sales, that contains detailed sales information. There is
one record for each sale for the first quarter that shows the site, product, invoice number,
invoice amount, and invoice date.
input Site $ Product $ Invoice $ InvoiceAmount InvoiceDate $;
V1009 VID010 V7679 598.5 980126
V1019 VID010 V7688 598.5 980126
V1032 VID005 V7771 1070 980309
V1043 VID014 V7780 1070 980309
V421 VID003 V7831 2000 980330
V421 VID010 V7832 750 980330
V570 VID003 V7762 2000 980302
V659 VID003 V7730 1000 980223
V783 VID003 V7815 750 980323
V985 VID003 V7733 2500 980223
V966 VID001 V5020 1167 980215
V98 VID003 V7750 2000 980223
title 'Sample Data to Create Summary Sales Report';
select * from sales;
194 Chapter 6 • Practical Problem-Solving with PROC SQL