Date: Mon, 7 Jul 2008 15:23:06 -0400
Reply-To: Joey Engelberg <j-engelberg@KELLOGG.NORTHWESTERN.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joey Engelberg <j-engelberg@KELLOGG.NORTHWESTERN.EDU>
Subject: Input All Files in a Folder
I have a question that I suspect has an answer, but I have seached online
for quite a long time and have yet to find one.
Suppose I have a folder called "MySasFolder" and inside MySasFolder I have
two files: "dog.txt" and "cat.txt". Inside the dog.txt file and cat.txt
files I have data that I want to read into a SAS dataset.
Is there a way that SAS can loop through all files in a folder and input
them into one SAS dataset without me having to tell SAS the names of each
file (I am working on a case where I have 1800 files in a folder)? When I
input each file into the SAS dataset I also need to keep the name of each
file as a variable (i.e. I would like to keep dog.txt and cat.txt in a
variable called FileName in my SAS dataset).
Any help would be much appreciated!!!