If the goal is to read lines of text into multiple shorter character variables then something like this should work.
Let's use 10 as the maximum length for one value so our example can be small.
First let's make a sample file.
options parmcards=txt;
filename txt temp;
parmcards;
one,two,three
1,2,3
1234567890,12345678901,123456789012
1234567890123456789012345678901234567890
;
Now let's read it in. We can use the LRECL= to tell SAS that the lines are longer than the default 32K bytes. Note there is a limit to how large LRECL can be, but it is probably more than 1 million on most installations of SAS.
We can use the LENGTH= and COLUMN= option to determine when we have reached the end of the line.
So let's just make one observation per each 10 bytes read. We can add some additional variables to indicate where the 10 bytes came from.
data tall ;
infile txt truncover length=ll column=cc lrecl=1000000 ;
length row col 8 value $10;
row+1;
do col=1 by 1 until(cc>ll);
input value $char10. @ ;
output;
end;
run;
Result:
Obs row col value
1 1 1 one,two,th
2 1 2 ree
3 2 1 1,2,3
4 3 1 1234567890
5 3 2 ,123456789
6 3 3 01,1234567
7 3 4 89012
8 4 1 1234567890
9 4 2 1234567890
10 4 3 1234567890
11 4 4 1234567890
... View more