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 (February 2011, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 28 Feb 2011 18:49:49 -0500
Reply-To:     Suzanne McCoy <Suzanne.McCoy@CATALINAMARKETING.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Suzanne McCoy <Suzanne.McCoy@CATALINAMARKETING.COM>
Subject:      Re: importint lots of txt files at once and taking the date from
              the              title
Comments: To: Nuria Chapinal <nchapinal@YAHOO.COM>
In-Reply-To:  <201102282332.p1SLUALF026231@waikiki.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

*make 3 filename statements, 1 for each file;

data inputfiles1; infile xyz1 missover; input @1 textstring $lrecl. @; if scan(textstring,1,' - ' then do; *parse the string to get your stat name and your date; *delete; end; else do; *input your numeric fields @1 firstfield 8. etc.; end; run;

...

data all; set inputfiles1 inputfiles2 inputfiles3; run;

** This is a shell and definitely may not be the most efficient but should get you started;

________________________________________ From: SAS(r) Discussion [SAS-L@LISTSERV.UGA.EDU] On Behalf Of Nuria Chapinal [nchapinal@YAHOO.COM] Sent: Monday, February 28, 2011 6:32 PM To: SAS-L@LISTSERV.UGA.EDU Subject: importint lots of txt files at once and taking the date from the title

Hi,

I have 3 batches of txt files in 3 different folders in my computer. They are consistent within batch in the number of columns and their format and the title format. All the columns are numerical. The title contains the date. I want to import and append all the txt files belonging to the same batch, and I want to create a column with the date in the SAS datasets.

The titles look like these (one example of each batch): close up activity - 11-03-2010 01-59.txt close up heifer activity - 11-03-2010 01-49.txt fresh cow activity - 11-03-2010 01-52.txt

Any advice on how to start will be appreciated. I have no experience importing txt files in SAS, only csv and excel.... I can send example files if anyone is very keen to help out ;)

Thanks in advance!


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