DATA Step, Macro, Functions and more

reading csv to process line-by-line

Accepted Solution Solved
Reply
Contributor
Posts: 29
Accepted Solution

reading csv to process line-by-line

In the past I've been able to read in a csv file to process it line-by-line, but for some reason the file I'm working on now only imports every other line.  Any information you can provide is appreciated.  Here's my code:

 

data cleaned;
missing;
infile "C:\temp\test.csv" lrecl=2000;
length lines $2000;
input lines $1-2000;
keep lines tag ;

if _N_ eq 1 then do;
find_CR_re=prxparse('/\n/'); /* Find carriage returns */
end;
retain find_CR_re;

if prxmatch(find_CR_re,lines) then tag=1; /* Looking for embedded carriage returns in line*/
run;


Accepted Solutions
Solution
‎02-06-2017 01:49 PM
Respected Advisor
Posts: 3,799

Re: reading csv to process line-by-line

I believe you need INFILE statement option TRUNCOVER.

View solution in original post


All Replies
Solution
‎02-06-2017 01:49 PM
Respected Advisor
Posts: 3,799

Re: reading csv to process line-by-line

I believe you need INFILE statement option TRUNCOVER.

Contributor
Posts: 29

Re: reading csv to process line-by-line

Posted in reply to data_null__

Thanks.  That did it!  Much appreciated.

☑ This topic is solved.

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

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