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 (April 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, 12 Apr 2000 15:44:46 +0100
Reply-To:     detecsm_hellriegelg@WESTLB.DE
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gehard Hellriegel <detecsm_hellriegelg@WESTLB.DE>
Subject:      Re: Read the last line in a flat file with SAS
Content-type: text/plain; charset=us-ascii

another 8% - 9% faster was:

data FILE01; infile XXX end=EOF; input @; if EOF then do; input VAR1-VARn; output; end; run;

0.85 sec instead of 0.92 sec with 50.000 records under Win NT, SAS 6.12

I don't know exactly, why!

I had the idea, that it should be possible to calculate the no of records and use something like

input #50000 a $50.;

That works, but is 20-30% less efficient! SAS has no option to read only the #50000th record but reads them all! Only with VSAM datasets and the KEY (KSDS) or the RBA there might be other possibilities.

Nigel Pain <Nigel.Pain@SCOTLAND.GOV.UK> am 12.04.2000 13:30:28

Bitte antworten an Nigel.Pain@SCOTLAND.GOV.UK

An: SAS-L@LISTSERV.UGA.EDU Kopie: (Blindkopie: DeTeCSM HellriegelG/D/ExternalStaff/WLB) Thema: Re: Read the last line in a flat file with SAS

Even more efficient might be:

data FILE01; infile XXX end=EOF; input @; if EOF; input VAR1-VARn; run;

*************************************************** Nigel Pain Scottish Executive Development Department Business Support Unit Victoria Quay EDINBURGH EH6 6QQ UK Tel +44 131 244 7237 Fax +44 131 244 7281 Mailto:nigel.pain@scotland.gov.uk Website: http:\www.scotland.gov.uk

-----Original Message----- From: Winston Groenewald [mailto:jacov@ABSA.CO.ZA] Sent: 12 April 2000 12:32 To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Read the last line in a flat file with SAS

********************************************************************** This email has been received from an external party and has been swept for the presence of computer viruses. **********************************************************************

Stuart,

Alternatively, you might want to try,

data FILE01; infile XXX end=EOF; input @; if EOF then do; input VAR1-VARn; output; end; run;

Sincerely, Winston Groenewald Johannesburg, SA

>Stuart, > >Try this... > >DATA FILE1; >INFILE FILENAME END=EOF; >INPUT ........... > ; >IF EOF THEN OUTPUT; >RUN; > >While this will actually read each record in the flat file, it will only >write the last record to the SAS file (FILE1). > >HTH. > >Regards, >Rick. >> -----Original Message----- >> From: Stuart Bridge [SMTP:stuart.bridge@NOSPAM.TEAM.TELSTRA.COM] >> Sent: Wednesday, April 12, 2000 2:31 PM >> To: SAS-L@LISTSERV.UGA.EDU >> Subject: Read the last line in a flat file with SAS >> >> Does anyone know an easy way to read the last record in a flat file using >> SAS (which contains the summary data for the file). >> >> I know using the INFILE FINENAME OBS=1 will read the first line only. Is >> there a similar command to read the last record only. If not, any ideas >> how >> I can do this in a variable length flat file? Thanks. >> >> Regards, >> Stuart Bridge > > >********************************************************************** >CAUTION: This Message may contain "confidential" information intended >only for the use of the addressee named above. If you are not the >intended recipient of this message you are hereby notified that any >use, dissemination, distribution or reproduction of this message is >prohibited. If you received this message in error please notify >Mail Administrators immediately. Any views expressed in this >message are those of the individual sender and may not necessarily >reflect the views of Woolworths Ltd. >**********************************************************************

********************************************************************** This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. **********************************************************************

Mit freundlichen Gruessen

DeTeCSM, Gerhard Hellriegel

WestLB Abteilung: 001-80622 Aderstr. 22 D - 40217 Duesseldorf Tel.: +49211 826 6173 Fax: +49211 826 5393


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