Infile, delimiter

Accepted Solution Solved
Reply
Valued Guide
Posts: 860
Accepted Solution

Infile, delimiter

Hello,

I am trying to pull a file from unix.  It was emailed to me in a .dat format.  I saved it to a drive, then ftp'd it to unix and am not using the attached code.  I'll also attach the log, you can see at the end of the log that it is reading a very large file but my results only show 1 field.  I'm not sure why it sees the entire file but only pulls in one row.  There are 140 variables that seem to be loading correctly for that one record.

Any help will be appreciated.

Thanks,

Attachment
Attachment

Accepted Solutions
Solution
‎10-02-2012 06:55 PM
PROC Star
Posts: 1,167

Re: Infile, delimiter

Posted in reply to Steelers_In_DC

Check the TERMSTR option of the INFILE statement. Unix and Windows use different strings to terminate a line; you may be looking for the wrong one.

Tom

View solution in original post


All Replies
PROC Star
Posts: 7,471

Re: Infile, delimiter

Posted in reply to Steelers_In_DC

What is the purpose of the next to the last line in your code, namely:

EOF;

?????

Valued Guide
Posts: 860

Re: Infile, delimiter

That has been removed, it was in the file as an empty variable.  I have removed it, the file still reads in the same way without it.

Super User
Posts: 5,503

Re: Infile, delimiter

Posted in reply to Steelers_In_DC

It looks like the data is using hex code 0A to mark the end of each line of data, but your operating system treats 0A as text.  I suspect this has to be fixed earlier in the process, not after the fact.  SAS could correct a few lines of data in this format, but your final line length will be far longer than anything SAS could handle at this point.


Valued Guide
Posts: 860

Re: Infile, delimiter

Posted in reply to Astounding

I suspected it had something to do with the length, or end of the row, the length will be whatever I set the lrecl as, I understand the problem but not the solution, does this have to be fixed in the file itself?  What can I do to fix the issue, if anything?

Valued Guide
Posts: 860

Re: Infile, delimiter

Posted in reply to Steelers_In_DC

Is there anything I can put in the end of the infile to designate the end of a row?

PROC Star
Posts: 7,471

Re: Infile, delimiter

Posted in reply to Steelers_In_DC

Can you post a couple of rows of your actual . dat file?

Solution
‎10-02-2012 06:55 PM
PROC Star
Posts: 1,167

Re: Infile, delimiter

Posted in reply to Steelers_In_DC

Check the TERMSTR option of the INFILE statement. Unix and Windows use different strings to terminate a line; you may be looking for the wrong one.

Tom

Valued Guide
Posts: 860

Re: Infile, delimiter

Tom,

That was right.  I changed the TERMSTR to LF and it seems to be working correctly.

Thanks for the help.

🔒 This topic is solved and locked.

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

Discussion stats
  • 8 replies
  • 285 views
  • 3 likes
  • 4 in conversation