Learning SAS? Welcome to the exclusive online community for all SAS learners.

LOG is showing more records were read from infile

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

LOG is showing more records were read from infile

I had this INFILE Traffic.dat which contains 8 records:

freeway 408                                     3684 3459

surface Martin Luther King Jr. Blvd.   1590 1234

surface Broadway                            1259 1290

surface Rodeo Dr.                            1890 2067

freeway 608                                     4583 3860

freeway 808                                     2386 2518

surface Lake Shore Dr.                     1590 1234

surface Pennsylvania Ave.                1259 1290

And here is the code:

DATA freeways;

  INFILE '/folders/myshortcuts/Practice/Chapter_2/Traffic.dat';

  INPUT Type $ @;

  IF Type = 'surface' THEN DELETE;

  INPUT Name $ 9-36 AmTraffic PmTraffic;

RUN;

While reading the file Log message is saying "NOTE: 10 records were read from the infile '/folders/myshortcuts/Practice/Chapter_2/Traffic.dat'." but it should be 8 records were read from the infile.

Why so?


Accepted Solutions
Solution
‎07-28-2015 10:22 AM
New Contributor
Posts: 3

Re: LOG is showing more records were read from infile

Hi Amit_37,

I have just run the data and your syntax on my side and I have the correct imported observations. Is it possible that there may be extra lines in the .dat file - Possibly check to see if you only have 3 left after deleting the surface observations.

Hope this suggestion helps out.

View solution in original post


All Replies
Solution
‎07-28-2015 10:22 AM
New Contributor
Posts: 3

Re: LOG is showing more records were read from infile

Hi Amit_37,

I have just run the data and your syntax on my side and I have the correct imported observations. Is it possible that there may be extra lines in the .dat file - Possibly check to see if you only have 3 left after deleting the surface observations.

Hope this suggestion helps out.

New Contributor
Posts: 3

Re: LOG is showing more records were read from infile

Thank you for your reply.

There were blank rows present in .dat file, because of that mismatch was there in log.

Contributor
Posts: 74

Re: LOG is showing more records were read from infile

I copied the info into a file and ran the program.  8 records were read.  I would guess that you have some carriage returns or or other non-printing characters after the actual data in the source file.

Super User
Super User
Posts: 7,997

Re: LOG is showing more records were read from infile

What does the imported dataset look like.  Its likely you have three end of line characters in the text file, which will create 3 empty rows.

🔒 This topic is solved and locked.

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

Discussion stats
  • 4 replies
  • 395 views
  • 8 likes
  • 4 in conversation