catx(",",tax_Nr) will yield one of your tax_Nr, which is not entirely numeric, therefore the input with best12. will fail. My solution for such tasks is a data step: proc sort data=have; by Cust_Nr; run; data want (keep=Cust_Nr number_of_pk tax_Nr_NEW); set have; by Cust_Nr; length tax_nr_NEW $ 50; *size this sufficiently big to hold all possible tax_Nr; retain tax_Nr_NEW number_of_pk ; if first.Cust_Nr then do; tax_Nr_NEW = ''; number_of_pk = 0; end; tax_Nr_NEW = catx(',',trim(tax_Nr_NEW,trim(tax_nr)); number_of_pk + 1; if last.Cust_Nr then output; run;
... View more