data x;
infile '/folders/myfolders/test.txt' termstr=lf;
input x $1. @@;
run;
data x;
n=0;
do until(last.x);
set x;
by x notsorted;
n+1;
end;
do until(last.x);
set x;
by x notsorted;
if x='"' then count=n;
output;
end;
drop n;
run;
data x;
set x;
mod=mod(count,2);
run;
data x;
set x;
array xx{0:1} $ 4 _temporary_ ('off' 'on');
length flag $ 4;
retain flag 'off';
by x notsorted;
if last.x and mod=1 then do;
n+1; flag=xx{mod(n,2)};
group+1;
end;
if flag='off' and x=',' then group+1;
drop n;
run;
data temp;
length value $ 200;
do until(last.group);
set x;
by group notsorted;
value=cats(value,x);
end;
value=prxchange('s/^[",]+//',1,value);
if value not in (' ' '0D'x) then output;
run;
data temp;
set temp;
if mod(_n_,4)=1 then obs+1;
run;
proc transpose data=temp out=want(drop=_name_);
by obs;
var value;
run;
... View more