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 (March 2001, 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 Mar 2001 15:43:15 +0100
Reply-To:     Peter Crawford <peter.crawford@DB.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <peter.crawford@DB.COM>
Subject:      Datastep looping
Comments: To: Don_Stanley@bnz.co.nz
Content-type: text/plain; charset=iso-8859-1

Hi Don The EOF switch is not evaluated until the first INPUT statement. So your code never satisfies the test in the first line generated by the macro. I think the "looping" condition occurs because you have input in a step which cannot read from it, because you issue a delete if _n_=1; Here is result of my test, using SET with end=eof. It generates the same looping message 558 data test ; 559 put eof= ; 560 if _n_ > 1 then DELETE ; 561 set end=eof; 562 put eof= ; 563 run ;

eof=0 eof=1 eof=1 NOTE: DATA STEP stopped due to looping. NOTE: There were 1 observations read fro NOTE: The data set WORK.TEST has 1 obser NOTE: The DATA statement used 0.01 CPU s

564 data test ; 565 put eof= ; 566 set end=eof; 567 if _n_ > 1 then DELETE ; 568 put eof= ; 569 run ;

eof=0 eof=1 eof=1 NOTE: There were 1 observations read fro NOTE: The data set WORK.TEST has 1 obser NOTE: The DATA statement used 0.01 CPU s

I think the condition is a data step loop which has a set statement (or merge or input ?) but which does not execute that statement in the current iteration. The same "looping" message surfaces in v6.12 Somewhere in SAS-L archives, this question must have been investigated. Regards Peter Crawford

Datum: 29/03/2001 05:41 An: SAS-L@listserv.uga.edu

Antwort an: Don_Stanley@bnz.co.nz

Betreff: Datastep looping Nachrichtentext:

Maybe I'm in brain switched off mode today ...

Given this TEST file on MVS V609E TS470

********************************* Top of Data ********************************** TEST ******************************** Bottom of Data ********************************

why does this code

49 options mprint ; 50 data test ; 51 infile testcase end=eof ; 52 53 %p_hdr(eofvar=EOF,eofonly=Y) ; MPRINT(P_HDR): IF EOF AND _N_ EQ 1 THEN DO ; MPRINT(P_HDR): PUT 'NO DATA IN THE INPUT FILE' ; MPRINT(P_HDR): ABORT ABEND 999 ; MPRINT(P_HDR): END ; MPRINT(P_HDR): IF _N_ EQ 1 THEN DELETE ; 3 The SAS System

54 input @1 ; put _infile_ ; 55 run ;

NOTE: The infile TESTCASE is: Dsname=IS413.D30920.FORMATS(TESTCASE), Unit=3390,Volume=M2P02D,Disp=SHR,Blksize=80, Lrecl=80,Recfm=FB

NOTE: DATA STEP stopped due to looping. NOTE: 0 records were read from the infile TESTCASE. NOTE: The data set WORK.TEST has 0 observations and 0 variables. NOTE: The DATA statement used 0.02 CPU seconds and 5049K.

issue the looping message? I would have expected it to do the delete when _n_=1, and since it hasn't read a record yet, to read the single record when _n_=2. The debugger seems to imply that the code stops after the DELETE when _n_ = 1, no obvious signs of looping.

The DELETE isn't necessary, I'm changing the macro that generates this to stop it appearing, but I'm curious why the datastep thinks its looping.

Any ideas? Thanks Don

WARNING: The contents of this E-mail may contain information that is legally privileged and/or confidential to the named recipient. This information is not to be used by any other person and/or organisation. The views expressed in this document do not necessarily reflect those of the Bank of New Zealand.

--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


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