Hello,
data test;
length var tmp $3000;
do i=1 to 501;
call catx(' ',var,cats('A',i,';'));
end;
tmp=prxchange('s/(.{1,199}; *)/${1}#/',-1,var);
call symputx('n',countw(tmp,'#'));
run;
data test;
set test;
array vars $200. var1-var&n.;
do i=1 to &n.;
vars(i)=scan(tmp,i,'#');
end;
keep var1-var&n.;
run;
Edit :
A variant with a single data step but the number of variables is guessed instead of computed.
%let n=50; /* Array size */
data test;
set test;
length tmp $3000;
array vars $200. var1-var&n.;
tmp=prxchange('s/(.{1,199}; *)/${1}#/',-1,var);
nvars=countw(tmp,'#');
if nvars>dim(vars) then put "Warning: insufficient array size";
do i=1 to nvars until (i=dim(vars));
vars(i)=scan(tmp,i,'#');
end;
keep var1-var&n.;
run;
... View more