Here is a method that should work as long as a couple of conditions are met.
1) The extra line breaks don't appear after the last delimiter of a line. Your example seems to imply that your lines have an extra delimiter at the end past the last value so that should never happen.
2) The actual data does not have any delimiters. Normally in a delimited file values with delimiters are enclosed in double quotes so that the reader can know not to treat it as indicating the end of the field. This program does have any logic to handle that situation.
Basically this program keeps track of how many pipe characters it has output. When that number is less than number per line then it leaves the output line open. Otherwise it terminates the output line and resets the counter. It replaces the line break with a space. You could use some other character or even nothing, but it looked like your actual data already had a semi-colon so space is probably fine for your case.
First let's make a sample data file.
filename sample temp;
data _null_;
file sample;
put 'var1|var2|var3|var4|var5|var6|var7|var8|var9|var10';
put '1|2|3|4|5|6|7|8'/'has'/'multiple'/'lines|9|10';
put 'a|b|c|d|e|f|g|h|i|j';
run;
Now let's run the program to convert that into a file with one line per observation.
filename want temp;
data _null_;
infile sample;
file want;
input ;
put _infile_ @;
npipe+countc(_infile_,'|');
if npipe < 9 then put ' ' @;
else do;
put;
npipe=0;
end;
run;
Results:
var1|var2|var3|var4|var5|var6|var7|var8|var9|var10
1|2|3|4|5|6|7|8 has multiple lines|9|10
a|b|c|d|e|f|g|h|i|j
... View more