The basic idea is data have ;
length oid $50.;
oid='123451122312390' ;output;
oid='1234690876' ;output;
run;
data want1;
set have;
oid1= substr(oid,1,5);
oid2=substr(oid,6,5);
run; Or in a simple macro %macro split;
data want2;
set have;
%do i = 1 %to 100 %by 5 ;
%put &i;
oid&i = substr(oid, &i , 5);
%end;
run;
%mend split;
%split; you could enhance the macro by working out the (maximum length / 5) of your initial variable and therefore how many new variables you would need to create .
... View more