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 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 9 Feb 2000 21:15:26 +1300
Reply-To:     Don Stanley <don_stanley@XTRA.CO.NZ>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Don Stanley <don_stanley@XTRA.CO.NZ>
Subject:      Re: Any Way To Reference Multiple _INFILE_s?
Comments: To: peter.crawford@db.com
Comments: cc: theodp@aol.com
Content-Type: text/plain; charset=us-ascii

i like that ... sensible i guess since each infile has its own buffer. thanks peter, good response.

Don

peter.crawford@db.com wrote:

> Of course Don may be right in that the _infile_ buffer is the object of > interest. > If that is the case, then Don may be over-cautious about it's availability. > > _infile_ remains available until the first input after a line is released. > It is as if the infile statement provides only the pointer to the current input > buffer > > 258 data _null_; /* creating simple test data files */ > 259 file file_a ; put 'line 1' / 'line 2' / 'line 3' /; > 260 file file_b ; put 'line A' / 'line B' / 'line C' /; > 261 run; > > NOTE: The file FILE_A is: > FILENAME=c:\crawford\SAS\FILE_A.DAT, > RECFM=V,LRECL=256 > > NOTE: The file FILE_B is: > FILENAME=c:\crawford\SAS\FILE_B.DAT, > RECFM=V,LRECL=256 > > NOTE: 4 records were written to the file FILE_A. > The minimum record length was 0. > The maximum record length was 6. > NOTE: 4 records were written to the file FILE_B. > The minimum record length was 0. > The maximum record length was 8. > NOTE: The DATA statement used 0.06 seconds. > > 262 data _null_ /debug; /* REAL testing *****/ > 263 infile file_a ; input ; put _infile_ ; > 264 infile file_b ; input ; put _infile_ ; > 265 infile file_a ; put _infile_ ; > 266 infile file_b ; put _infile_ ; > 267 if _n_ gt 2 then stop; > 268 run; > > NOTE: The infile FILE_A is: > FILENAME=c:\crawford\SAS\FILE_A.DAT, > RECFM=V,LRECL=256 > > NOTE: The infile FILE_B is: > FILENAME=c:\crawford\SAS\FILE_B.DAT, > RECFM=V,LRECL=256 > > line 1 > line A > line 1 > line A > line 2 > line B > line 2 > line B > line 3 > line C > line 3 > line C > NOTE: 3 records were read from the infile FILE_A. > The minimum record length was 6. > The maximum record length was 6. > NOTE: 3 records were read from the infile FILE_B. > The minimum record length was 8. > The maximum record length was 8. > NOTE: The DATA statement used 49.92 seconds. > > /debug testing proved that the _infile_ buffer is not even cleared at the end of > the data step loop > > Testing on os390 shows the same effects as the above test on winNT > > Datum: 08.02.2000 19:47 > An: SAS-L@listserv.uga.edu > > Antwort an: don_stanley@xtra.co.nz > > Betreff: Re: Any Way To Reference Multiple _INFILE_s? > Nachrichtentext: > > I think you've all missed the real question. Theo wanted to access _infile_ for > each > infile he has, and not lose the information retained in a prior one. Th eanswer > I > believe is no, unless you can copy _infile_ to a macro variable then use SYMGET > to > re-use in same step -- haven't tried this. > > Don > > Peter Crawford wrote: > > > A data step can input from more than one infile, Each input statement reads > from > > the infile statement refered to most recently. > > The following step (has been tested) might give some idea of this. > > data; > > infile ddnam1 truncover /* etc */ ; > > input from first infile ddnam1 @; > > infile ddnam2 lrecl=1000 dsd dlm=' ' missover /* etc */; > > input somefrom second infil ddnam2 ; > > infile ddnam1 /* options for ddnam1 still apply */ ; > > input moreFrom ddnam1 /*held*/ input record; > > infile ddnam2 ; > > input next record fields from ddnam2 ; > > run; > > > > To dynamically (at run time) define the external file name to use for the > > infile, use the infile option FILEVAR=, Being dynamic it gets more > complex..... > > > > Datum: 08.02.2000 15:17 > > An: SAS-L@listserv.uga.edu > > > > Antwort an: theodp@aol.com > > > > Betreff: Any Way To Reference Multiple _INFILE_s? > > Nachrichtentext: > > > > Is there any way to refer to multiple _INFILE_s (e.g., by DDNAME) in a single > > data step, or does each INPUT destroy the prior one? > > > > Any changes under V8? > > -- > Don Stanley, B.SC, Dip O.R.S, MNZCS Director, Sysware Consulting Group > Box 634, Wellington, NEW ZEALAND > http://www.sysware.co.nz > EMAIL:: don_stanley@xtra.co.nz > http://www.geocities.com/don_stanley_nz/don_home.htm > Genealogy:: http://www.geocities.com/don_stanley_nz/family.htm

-- Don Stanley, B.SC, Dip O.R.S, MNZCS Director, Sysware Consulting Group Box 634, Wellington, NEW ZEALAND http://www.sysware.co.nz EMAIL:: don_stanley@xtra.co.nz http://www.geocities.com/don_stanley_nz/don_home.htm Genealogy:: http://www.geocities.com/don_stanley_nz/family.htm


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