filename baby pipe 'dir "D:\Original_Data\Claims\Baby\*.txt" /b'; data babyclaims; length fname file text $200.; infile baby truncover; input fname $; file='SAS_'||tranwrd(tranwrd(scan(fname,1,'.'),'-','_'), '', '_'); text='D:\Original_Data\Claims\Baby\\'||fname; call symput('num_files', put(_n_,best.)); run; data _null_; set babyclaims; call symputx('text'||strip(put(_n_,best.)), text, 'G'); call symputx('file'||strip(put(_n_,best.)), file, 'G'); run; %macro import; %do i=1 %to &num_files.; proc import file="&&text&i" out=babysas.&&file&i dbms=TAB replace;*/ getnames=yes; run; %end; %mend; %import; When I'm using proc import, some files can be imported correctly, but other can only import parial information of the file, say, only the first column of the file in SAS datasets. Some files do have common variables, but since there are over 30 variables in one file and I have over 100 files and each file is 2-3MB, I'm wondering if there is a way I can do without opening all the files and manually imput all the variable names? Many thanks! Hera
... View more