DATA Step, Macro, Functions and more

Reading a text file with embedded EOF characters in it

Accepted Solution Solved
Reply
Regular Contributor
Posts: 179
Accepted Solution

Reading a text file with embedded EOF characters in it

Hi,

 

I analyze log files which historically have been text based; with the increase in hacking attacks, these now contain binary data from other servers.  SAS can't read past certain locations and I suspect there is an embedded EOF character in them.

 

I've tried several options on the filename and infile statements to read the 11 lines of the attached sample.  Is there something I can use that will read all 11 lines?

 

Example:

 

data test;

infile 'c:\smtp.txt';

input;

put _infile_;

run;

 

only reports 4 lines read.

 

Thanks!

 

--Ben


Accepted Solutions
Solution
‎05-18-2017 09:17 AM
Super User
Posts: 10,035

Re: Reading a text file with embedded EOF characters in it

Posted in reply to BenConner


data test;
infile 'c:\smtp.txt' ignoredoseof;
input;
put _infile_;
run;
 


View solution in original post


All Replies
Super User
Super User
Posts: 7,970

Re: Reading a text file with embedded EOF characters in it

Posted in reply to BenConner

This seems to work fine for me:

data want;
  infile "c:\smtp.txt" lrecl=32767 dsd;
  length res $2000;
  input res $;
run;
Solution
‎05-18-2017 09:17 AM
Super User
Posts: 10,035

Re: Reading a text file with embedded EOF characters in it

Posted in reply to BenConner


data test;
infile 'c:\smtp.txt' ignoredoseof;
input;
put _infile_;
run;
 


☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 148 views
  • 1 like
  • 3 in conversation