SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

raw data fetching

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

raw data fetching

Hi,

 

If i am fetching raw data from external file and it is too heavy to open and there is a junk character in it which is not allowing me too fetch the data then how can we resolve this problem???

 


Accepted Solutions
Solution
‎01-23-2017 07:49 AM
PROC Star
Posts: 1,093

Re: raw data fetching

Does the log indicate which line the junk character is in?

 

I had a similar problem, and I did this:

 

First of all, figuire out what the issue is by just outputting the line with the junk character, something like (say the problem is in line 637):

 

data _null_;

infile 'blah';

file 'blah';

input;

if _n_ = 637 then put _infile_;

run;

 

Then examine the output file to figure out what the issue with the junk character is, and resolve it. The _infile_ variable can be quite helpful. I can't test it, but I think something like this would work (say your problem is in character 146):

 

data _null_;

infile 'blah';

file 'blah';

length InputRecord $whatever;

input;

if _n_ = 637

then do;

InputRecord = substr(_infile_, 1, 145)||substr(infile, 147);

put InputRecord;

end;

else put _infile_;

run;

 

Some combination of these kinds of operations should get you going.

View solution in original post


All Replies
Solution
‎01-23-2017 07:49 AM
PROC Star
Posts: 1,093

Re: raw data fetching

Does the log indicate which line the junk character is in?

 

I had a similar problem, and I did this:

 

First of all, figuire out what the issue is by just outputting the line with the junk character, something like (say the problem is in line 637):

 

data _null_;

infile 'blah';

file 'blah';

input;

if _n_ = 637 then put _infile_;

run;

 

Then examine the output file to figure out what the issue with the junk character is, and resolve it. The _infile_ variable can be quite helpful. I can't test it, but I think something like this would work (say your problem is in character 146):

 

data _null_;

infile 'blah';

file 'blah';

length InputRecord $whatever;

input;

if _n_ = 637

then do;

InputRecord = substr(_infile_, 1, 145)||substr(infile, 147);

put InputRecord;

end;

else put _infile_;

run;

 

Some combination of these kinds of operations should get you going.

Occasional Contributor
Posts: 6

Re: raw data fetching

Thank you..i ll try this code.
☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 288 views
  • 1 like
  • 2 in conversation