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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.