Help using Base SAS procedures

infile problem

Posts: 33

infile problem

Hi all,

I am using a simple infile statement to read in about 4 million records. For some reason sas stop at reading 700,00 and does not read the full file in. As the txt file is about 4gb i can not open it to see why. Having a look at the last record in the table i can not see why it is stopping. Any ideas? Thanks in advance
Posts: 0

Re: infile problem

In case you are using Windows, you can find some file-splitter utility. Anyway, a piece of your log would be useful.
Super Contributor
Super Contributor
Posts: 3,174

Re: infile problem

Agreed - SAS log with DATA step code would be helpful - and you may find setting END=EOF on the INFILE useful while doing some code like:


or use some HEX type SAS format to display the last record as SAS interprets the end-of-file condition.

Scott Barry
SBBWorks, Inc.
Trusted Advisor
Posts: 2,113

Re: infile problem

If you are on a PC and your text file includes a CTRL-Z, SAS will stop reading it. CTRL-Z is the (antique) end-of-file indicator left over from V6 days.
Respected Advisor
Posts: 3,777

Re: infile problem

Perhaps the option

is used in the context of I/O operations on variable record format files. When this option is specified, any occurrence of ^Z is interpreted as character data and not as an end-of-file marker.
Respected Advisor
Posts: 3,889

Re: infile problem

If the issue is caused by a control character then eventually the following code will help:

data want;
infile ;
input @;
_infile_=COMPRESS(_infile_, , "c");
input ;

If this works and you want to find the line with the control character then:

if length(_infile_) ne length(COMPRESS(_infile_, , "c")) should do the job.

You could of course also use find() or indexc() - but I assume compress will work faster.

SAS Employee
Posts: 19

Re: infile problem

You aren't using Learning Edition, are you?
If so, you are limited in the number of observations, so you could be hitting that limit.
Ask a Question
Discussion stats
  • 6 replies
  • 7 in conversation