proc sort data=have;
by ID;
run;
**********************************************************************;
*Use RETAIN and BY group processing to combine the information;
**********************************************************************;
data want_option1;
set have;
by ID;
length combined $100.;
retain combined;
if first.ID then
combined=name;
else
combined=catx(', ', combined, name);
if last.ID then
output;
run;
Or
proc transpose data=have out=wide prefix=name_;
by ID;
var name;
run;
data want_option2;
set wide;
length combined $100.;
combined=catx(', ', of name_:);
run;
@animesh123 wrote:
ID NAME
1 Animesh
1 Mardi
1 ABC
How to combine this into single variable
Output should be :- 1 Animesh Mardi abc