@smg3141 wrote:
Hello!
I have a large number of .txt files I would like to import, manipulate in the same manner, and export. Is it possible to use a DO loop for this?
For example, I would like to use a DO loop to import file1, file2, file3, etc. instead of typing out an import step for each individual file.
Right now I'm using
%let var1=file1;
proc import datafile="pathname\&var1..txt" out=example1 dbms = tab replace; run;
Then changing the macro to file2, file3, etc, and rerunning each time.
Thanks in advance!
Yes, you can use the FILEVAR. You could also use a macro do loop (%DO - %END).
See https://support.sas.com/resources/papers/proceedings/proceedings/sugi27/p082-27.pdf for further info on FILEVAR.
Jim
... View more