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 (October 1998, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 29 Oct 1998 11:02:31 GMT
Reply-To:   Bruce Rogers <B.Rogers@VIRGIN.NET>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Bruce Rogers <B.Rogers@VIRGIN.NET>
Organization:   Deja News - The Leader in Internet Discussion
Subject:   Re: Multiple external datasets

In article <K6XaaMAqq5N2EwaT@crawfordsoftware.demon.co.uk>, Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK> wrote: > In article <909601402.2129690.0@vm121.akh-wien.ac.at>, Quan Li > <qxl4@PSU.EDU> writes > >Dear SAS-L, > > > >I have multiple external files (about 100 ) that are in the same format > >(tab-delimited) and with the same variables that I would like to merge into > >one sas-dataset. Instead of using multiple data steps and infile > >statements, I wonder if there is an easier solution, such as reading them > >in one datastep and then merge into one. > > > >Thanks for any help. > > > >Best, > >Quan > >Quan Li > >Assistant Professor > >Department of Political Science > >The Pennsylvania State University > >Phone: 814.865-6575 > >Fax: 814.865-8979 > >Email: qxl4@psu.edu, quanli@psu.edu > > lookup what FILEVAR option of infile satatement does > > basically, it names the variable containing the external file name from > which you want to read > > filename fileref '.'; /* just make any dummy (but existing) fileref */ > data allofit(label='all 100 inputs together' > keep=var1 -- varz) ; > > infile cards; /* or somewhere else with your 100 files named */ > length from $66; /* allowing (slightly) long file names */ > input from &; /* make it more complex to support multi-blanks */ > > length var1 - var25 8 varA $16 /* ...... */ varZ $1; > /* whatever */ > > infile fileref filevar =from ..etc.. end=eof dsd dlm=',' truncover; > > do until( eof); > input var1 -- varZ ; > output; ****---------------<<<<<<<<; > end; > cards; > first filename > second filename > third filename > ; > -- > Peter Crawford

Why make it so complicated ? Surely it's simpler to concatenate the files into a single fileref? e.g. filename all ('c:\files\file1.dat'

-- Black Cat Solutions Ltd. SAS Software Specialists

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own


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