datastep - Is there a way to force cleansing the raw data before importing it via a data step, in SAS? -
sas eg
i have tab delimited text file has imported every month. wrote 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_ call symput('_efierr_',1); run;
a recent problem had there times when datalines have 2 tabs mistake. text file huge, in order of 500mb. tried automate process writing above, doesn't take problem in consideration. writes blank in place. when use in-built 'import data', first cleanses raw file , runs intermediate data step give desired output. doesn't give me blank in column. ignores tab.
an example of problem text file.
col1 col2 col3 1 b 2 foo bar 3 wayout data 4 example
is there way can automate cleansing process data step import? or, guys know steps should add of sort?
remove dsd option. dsd option tells sas treat 2 consecutive delimiters missing, whereas standard approach treat 2 consecutive delimiters single delimiter.
i cannot replicate issue. code works fine me on sas 9.4 ts1m3.
data txtimp; infile "c:\_localdata\temp\sample_tab_dlm_file.txt" missover lrecl=256 dlm='09'x firstobs=2 ; input col1 $ col2 $ col3 $; run;
Comments
Post a Comment