Use the following PROC
SQL code to create a column for each month of the quarter, and use
the summary function SUM in combination with the GROUP BY statement
to accumulate the monthly sales for each product:
proc sql;
title 'First Quarter Sales by Product';
select Product,
sum(Jan) label='Jan',
sum(Feb) label='Feb',
sum(Mar) label='Mar'
from (select Product,
case
when substr(InvoiceDate,3,2)='01' then
InvoiceAmount end as Jan,
case
when substr(InvoiceDate,3,2)='02' then
InvoiceAmount end as Feb,
case
when substr(InvoiceDate,3,2)='03' then
InvoiceAmount end as Mar
from work.sales)
group by Product;
PROC SQL Output for a Summary Report
Note: Missing values in the matrix
indicate that no sales occurred for that given product in that month.