DATA Step, Macro, Functions and more

Premature termination reading a text file

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 78
Accepted Solution

Premature termination reading a text file

I'm trying to read a file with 6.7M records, but my data step quits after only 105k with no errors.  There are control codes in the file that convinces SAS that the file has ended.  The file is an exported .csv file from the RapidSQL query tool on the same platform (WinXP, SAS 9.2).  (FYI, when I tried to read the data directly from the server via ODBC, it got stuck.  It ran overnight; I killed it and got no results.)  I can import the first million rows into excel, and, indeed it contains a funny character in the line that SAS stopped on.  It's character hex 1A, which is ctrl-z, the EOF character.

Q: Can control characters be cleaned out using SAS?

The (vastly simplified) code:

    data blah ;

        infile "textfile.csv" lrecl=32767 ;

        input;

An excerpt from the log:

NOTE: The infile "textfile.csv" is:

      Filename=C:\Projects\xxx\textfile.csv,

      RECFM=V,LRECL=32767,

      File Size (bytes)=962846799,

      Last Modified=16Jan2013:13:19:58,

      Create Time=16Jan2013:13:04:55

NOTE: 105454 records were read from the infile "textfile.csv".

      The minimum record length was 128.

      The maximum record length was 146.


Accepted Solutions
Solution
‎01-17-2013 10:38 AM
PROC Star
Posts: 7,365

Re: Premature termination reading a text file

Have you tried including the ignoredoseof option in your infile statement?

View solution in original post


All Replies
Solution
‎01-17-2013 10:38 AM
PROC Star
Posts: 7,365

Re: Premature termination reading a text file

Have you tried including the ignoredoseof option in your infile statement?

Frequent Contributor
Posts: 78

Re: Premature termination reading a text file

That worked!  SAS is such a multi-headed monster, "it takes a village" (this community) to tame it.  Thanks.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 260 views
  • 0 likes
  • 2 in conversation