LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2012, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 27 Jan 2012 20:46:42 -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:      extract information from File name?
Content-Type: text/plain; charset=ISO-8859-1

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!


Back to: Top of message | Previous page | Main SAS-L page