Reputation: 23
I have flat file (ACC format) with a LrecL of 8000 for each observation and the file has about 30k observations. When I am reading the dat ausing @ and Length statements I am able to read the first record correctly but not the remaining. Heres my code:
Data InterA;
infile "\\server\Data\ABC.acc" lrecl =8764;
input
@ 1 a 12.
@ 548 b 4.
@ 552 c 4.
@ 556 d 4.
@ 560 e 4.
@ 585 f 3.
@ 588 g 3.
.
.
.
.
.;
run;
The question I have is, how can read the entire file?
Thanks in advance!
Upvotes: 0
Views: 203
Reputation: 63424
There's nothing particularly special about enterprise guide in relation to LRECLs, and 8000-9000 is not enough to hit any possibly special issue with relation to OS or similar.
I suspect your issue is related to the record separator. Most likely, you are expecting CR+LF (on a Windows machine, for example), and the data has LF (Unix), or something similar to that. Or, it has no record separator. What's happening is SAS thinks you have one really, really long line, and doesn't know you have another line; so it stops reading after one iteration.
You can deal with this a few ways.
First, in the INFILE, you have the TERMSTR= option.
infile "//whatever/whatever.dat" termstr=LF lrecl=8764;
Second, if your lines are of fixed length (every line is identical), then use RECFM=F
to force SAS to read it in blocks of exactly 8764.
infile "//whatever/whatever.dat" recfm=f lrecl=8764;
That might need to be upped by one if there is a record separator. This is the solution you need if there is no record separator, though, nothing else will easily work with your current code.
Upvotes: 2