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???
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.
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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.