
Rick A. answered 04/20/19
Experienced SAS Professional
Here's one solution:
data raa;
input _1st $ _2nd $ _3rd $ _4th $ _5th $ _6th $ _7th $ _8th $;
datalines;
a b c d e f g h
aa bb cc dd ee ff gg hh
abc def ghi jkl mno pqr stu vwx
;
run;
data _null_;
set sashelp.vcolumn end=eof;
where libname = 'WORK' and memname = 'RAA';
x+1;
call symputx('field'||left(_n_), name);
if eof then call symputx('totfields', x);
run;
%macro final(infile=,outfile=,separator=);
data &outfile(drop=L);
set &infile;
format all_name $100.;
all_name=&field1.;
%do i=2 %to &totfields;
L=length(all_name);
all_name=substr(all_name,1,L) || "&separator." || &&field&i.;
%end;
run;
%mend final;
%final(infile=raa,outfile=raa2,separator=|);