Hi:
In the interest of providing alternatives, again, if you transpose your data but modify it slightly differently, then you can use either PROC REPORT or PROC TABULATE to create these results:
Here's the code:
data fakedata;
infile datalines;
input personID bought_hat wore_hat bought_gloves wore_gloves bought_scarf wore_scarf;
return;
datalines;
1 1 0 1 1 0 0
2 1 1 1 0 1 0
3 0 0 1 1 1 0
;
run;
proc transpose
data=fakedata
out=tr_long ;
by personid;
var bought_hat--wore_scarf;
run;
data final;
length Item $15 Status $8;
set tr_long;
Item = propcase(scan(_name_,2,'_'));
Status = propcase(scan(_name_,1,'_'));
run;
proc report data=final;
title 'Summary with PROC REPORT';
column item status,col1;
define item / group style(column)=Header;
define status/ across ' ';
define col1 / 'Total';
rbreak after / summarize style=Header;
compute after;
item='Total';
endcomp;
run;
title;
proc tabulate data=final f=3.0;
title 'Summary with PROC TABULATE';
class item status;
var col1;
table item=' ' all='Total'*{style=Header},
status=' '*col1='Total'*sum=' '/
box={label='Item' style={vjust=b}};
run;
Cynthia