Hi:
You want PROC TRANSPOSE to summarize according to customer and department, but it's just not going to cooperate. This is really a job for one of the summary report procedures, like PROC REPORT or PROC TABULATE.
I'd probably pick REPORT, but that's because in the grand scheme of things, I'm probably more of a REPORT person than a TABULATE person.
To get the output into Excel, I'd choose either HTML file or a Spreadsheet Markup Language file, as shown in the code below. Although, you could make an output dataset from either REPORT or TAB and then use PROC EXPORT, if you wanted to.
cynthia
[pre]
data product;
infile datalines;
input customer $ department product $;
return;
datalines;
001 300 Coffee
002 500 Tea
002 500 Tea
002 500 Coffee
003 700 Coffee
003 700 Tea
;
run;
title; footnote;
ods listing close;
options missing=0;
ods msoffice2k file='c:\temp\prod_HT.xls' style=sasweb;
ods tagsets.excelxp file='c:\temp\prod_XP.xls' style=sasweb;
proc report data=product nowd;
column ('With Proc Report' customer department)
n,product ;
define customer / group ;
define department / group;
define product /across;
define n / ' ';
run;
proc tabulate data=product f=comma6.;
class customer department product;
table customer*department,
n*product /box='With Proc Tabulate';
keylabel n=' ';
run;
ods _all_ close;
[/pre]