Since you already know the problem cases perhaps this alternative:
proc format library=work;
value $NewComp
'A','B' = 'BA'
'C','D' = 'CD'
;
run;
data want;
set have;
NewCompany=put(company,$NewComp.);
run;
I often find that Formats are good for mapping /combining changed coded or names.
With the format you may not even need a new data set but apply the format to the variable in the summary or display procedure that does grouping.
Such as
proc summary data=have;
class company;
format company $newcomp. ;
var sales;
run;
... View more