rockfido 发表于 2010-7-16 23:52 
......but i have thousands of names instead of just a, b,c and more than just 1,2,3 types......
but thank you all the same!
对data不是很熟。借用版主的程序,抛砖引玉一个吧
data crackman;
input NAME $ TYPE@;
obs=_n_;
datalines;
A 1
A 1
A 2
B 1
C 1
C 3
C 2
;
run;
data test (drop=obs);
set crackman;
length newstring $2000;
by name;
retain newstring;
if first.name then newstring='';
newstring = COMPRESS(newstring)||COMPRESS(TYPE);
run;