Date: Sat, 28 Jan 2012 23:33:55 -0500
Reply-To: help ly <help.ly2005@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: help ly <help.ly2005@GMAIL.COM>
Subject: Re: extract information from File name?
In-Reply-To: <201201281806.q0S8S8mO011308@wasabi.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
Thank you all for the great solutions and information!
On Sat, Jan 28, 2012 at 1:06 PM, Gabriel Farkas <g.farkas@gmail.com> wrote:
> SAS has some macros on their support site that basically do the bulk of
> what
> you're looking for: http://support.sas.com/kb/8/710.html
>
> They provide a good starting point. In the past, I've taken the macro
> MULTIFILEIMPORTERWIN9 and customized it a bit to do things I want that are
> along the same lines as what you're looking for. You probably can do
> something similar.
>
>
> On Fri, 27 Jan 2012 20:46:42 -0500, help ly <help.ly2005@GMAIL.COM> wrote:
>
> >Hi Everyone,
> >
> >I am reading lots of files in SAS, such as:
> >corp1.csv
> >corp2.csv
> >corp3.csv
> >corp4.csv
> >............
> >
> >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
> >"corp1".
> >
> >Is there an efficient way to extract that part of information from each
> >individual File name while reading the whole set?
> >
> >--
> >Thanks so much!
> >
> >Orange
> >help.ly2005@gmail.com
>
--
Thanks so much!
Orange
help.ly2005@gmail.com
|