I'm a beginner to SAS. I'm trying to have nested counts presented cleanly as follows. This is code to generate toy data, as well as 3 attempts I tried (from hours of googling how to do this) that give the correct info, but none are as clean as the above. Imagine how awful they'd look when I need more than 2 layers of nesting. and multiplying together the total number of categories per variables is large, but the actual number of their combinations in the data is small. data toy;
input A $ B $;
datalines;
A1 B1
A1 B2
A1 B2
A2 B1
A2 B1
A2 B1
A2 B2
A2 B2
A2 B2
A2 B2
;
proc tabulate data=toy;
class A B;
table A*(B all) all;
run;
proc summary data=toy print;
class A B;
run;
proc freq data=toy;
tables A*B / nopercent norow nocol;
run;
... View more