DATA TEST;
INPUT (univ startdate expdate products) ($);
CARDS;
清华 4月1 9月1 A
清华 4月1 9月1 B
清华 4月1 9月1 C
北大 5月1 10月1 D
北大 5月1 10月1 E
北大 5月1 10月1 F
;
RUN;
PROC SORT;
BY notsorted univ startdate expdate;
data want(rename=(pro=products));
set test;
by notsorted univ startdate expdate;
retain pro;
if first.univ then pro=products;
else pro=COMPRESS(pro!!products);
drop products;
if last.univ;
run;
PROC PRINT NOBS;
RUN;
X结果不正是你要求的吗?
|