DATA Step, Macro, Functions and more

Problem reading Reading text file

Reply
Frequent Contributor
Posts: 99

Problem reading Reading text file

Hi Everyone,
I am trying to read comma delimited text file. The SAS dataset reads a "square sign" in the last column. How do I get rid of it.

infile '/path/data.txt' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;

Thanks,

Amit
Trusted Advisor
Posts: 2,115

Re: Problem reading Reading text file

It's likely the end-of-line character for a record from the PC .csv file that was copied to Unix. Check out this thread:

http://support.sas.com/forums/message.jspa?messageID=20381#20381

If that is not it, tell us more about your platform and the data sources.
Respected Advisor
Posts: 3,799

Re: Problem reading Reading text file

You could add the INFILE option TERMSTR with no need to fiddle with the input file(s).

[pre]
infile ..... termstr=crlf;
[/pre]
Valued Guide
Posts: 2,177

Re: Problem reading Reading text file

add '0A'x as delimiter on infile.[pre]infile '/path/data.txt' delimiter= '2c0d'x MISSOVER DSD lrecl= 32767 firstobs= 2 ;[/pre]Then if any '0D'x disappear, the ''0A'x on its own will still act as a line terminator.

PeterC
Ask a Question
Discussion stats
  • 3 replies
  • 149 views
  • 0 likes
  • 4 in conversation