SAS Find Top Combinations in Dataset -
hell --
i have sales data looks this:
data have; input order_id item $; cards; 1 1 b 2 2 c 3 b 4 4 b ; run; what i'm trying find out popular combinations of items ordered. example in above case, there 2 orders contained items a&b, 1 order of a&c, , 1 order of b. best way output different combinations along numbers of orders placed?
it seems there no permutation issue, try this:
proc sort data=have; order_id item; run; data temp; set have; order_id; retain comb; length comb $4; comb=cats(comb,item); if last.order_id do; output; call missing(comb); end; run; proc freq data=temp; table comb/norow nopercent nocol nocum; run;
Comments
Post a Comment