I am importing a flat .txt file with both row and column delimiters. The problem is that the row delimiter is used to reduce file size and so often the rest of the columns are skipped. Another problem is that the length of the longest character is unknown and so, if this char string is truncated then we lose the delimiter and the whole structure falls apart.
An explicit example of the problems I am facing include
.txt file
Var1'~'Var2'~'Var3'~'Var4'~'Var5'~'Var6'#@#@'
1'~''#@#@'
This is going to be a really long string as an example of a situation where the long string is very large and so the truncated string does not indicate a delimiter and we lose data '#@#@'
1'~' 2'~' 3'~' 4'~' 5'~' 6'#@#@'
1'~' 2'~' 3'~''#@#@'
I am having a lot of problems trying to import this data due to a number of reasons:
putting a very large length for the character variables makes the import process very time consuming and we do not know the length of the longest character var so each iteration takes more time
I have not yet found a way to deal with both the column and row delimiter when the structure means that the next row can be signalled before all the columns have been filled in i.e. can't just make an extra column for the row delimiter and drop it.
SAS code for which I have tried:
data want;
infile "file-location" dlmstr = "#@#@" dsd recfm = F lrecl=10000000000;
informat var $200.
input var $ @@;
run;
Any experience and insight is greatly appreciated.