Yes indeed a very good solution provided with arrays, alternatively with tranpose step we could get the same result as below proc sort data=have;
by code;
run;
proc transpose data=have out=new;
by code;
var var2-var6;
run;
data new2;
set new;
col2=scan(col1,2,':');
col1=scan(col1,1,':');
if col1 ne '';
drop _name_;
run;
proc transpose data=new2 out=trans(drop=_name_);
by code;
var col2;
id col1;
run; Please try and check. Thanks, Jag
... View more