data have;
input company $;
cards;
a
a
a
a
a
b
b
b
b
b
c
c
c
c
c
;
data want;
do until(last.company);
set have;
by company;
length code $10;
code=cats('COMP',_n_);
output;
end;
run;
A good idea, but it can be done with a slightly quicker program:
data want;
length code $ 10;
code = cats('comp', _n_);
do until (last.company);
set have;
by company;
output;
end;
run;
Ready to join fellow brilliant minds for the SAS Hackathon?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.