SAS EG
I have a Tab delimited text file that has to be imported every month. So I wrote an import procedure via data step.
data lib.txtimp;
%let _EFIERR_=0;
infile "file/path/tabdlm.txt" lrecl=256
dlm='09'x missover firstobs=2 DSD;
informat <vars>;
format <vars>;
input <vars>;
if _ERROR_ then call symput('_EFIERR_',1);
run;
A recent problem I had is that there are times when some datalines have two tabs by mistake. The text file is huge, in order of 500MB. So I tried to automate the process by writing the above, but it doesn't take the problem in to consideration. It writes a blank in that place. When I use the in-built 'Import Data', it first cleanses the raw file and then runs its intermediate data step to give the desired output. This doesn't give me a blank in that column. It ignores the extra tab.
An example of the problem with my text file.
col1 col2 col3
1 a b
2 foo bar
3 wayout data
4 another example
Is there a way that I can automate the cleansing process with my data step import? Or, do you guys know any steps that I should add to get something of that sort?