Date: Fri, 27 Jan 2012 20:37:55 -0600
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: extract information from File name?
Content-Type: text/plain; charset=ISO-8859-1
There is a filename option on the infile statement that will do what you
want, though you need to create an additional variable if you want to keep
it, as the filename=<variable> will not be written to the dataset.
length file_name $50;
infile "c:\temp\*.csv" filename=file_name;
file_name_ds = file_name;
On Fri, Jan 27, 2012 at 7:46 PM, help ly <email@example.com> wrote:
> Hi Everyone,
> I am reading lots of files in SAS, such as:
> filename Files '/srf/*.txt';
> data out.Data;
> infile Files......;
> I will need get the Company name from the individual file name, and insert
> a column in each data set after reading the txt file. For example, after
> Data from corp1.csv is read, I would like to add a variable CompanyName as
> Is there an efficient way to extract that part of information from each
> individual File name while reading the whole set?
> Thanks so much!