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 1999, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 20 Apr 1999 19:35:41 GMT
Reply-To:     Melvin Klassen <Klassen@UVIC.CA>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Melvin Klassen <Klassen@UVIC.CA>
Organization: University of Victoria
Subject:      Re: Pointer Controls
Content-Type: text/plain; charset="us-ascii"

On Tue, 20 Apr 1999 16:48:36, Srna Carol <Carol.Srna@M1.IRS.GOV> wrote:

> Please help. This is my code: > DATA TEMP1; > INFILE INA PAD; > INPUT @24 STATUS $CHAR9. @; > IF STATUS = 'NOT FOUND' THEN DO; > INPUT @12 NAME $CHAR7.; > OUTPUT; > END; > ELSE DELETE; > PROC PRINT DATA=TEMP1; VAR NAME; > > The variables STATUS and NAME are on the same line. > NAME is before STATUS in the line. > How do I get back to NAME > after I have found the STATUS of "NOT FOUND" ?

Your above SAS program is correct.

Adding 'DROP STATUS' statement is recommended, since the value of 'STATUS' in the output dataset will always be the same, namely 'NOT FOUND', so, there's little need to carry that "baggage".

Since you have an explicit 'OUTPUT' statement, which disables the implicit 'OUTPUT' which SAS executes at the end of each iteration, you can omit the 'ELSE DELETE' statement, without changing the logic of the program.

Similarly, using 'ELSE RETURN;' tells SAS to start a new iteration, without doing an 'OUTPUT' on the current observation.

SAS automatically starts a new record for each iteration, so there is no need to code something like 'ELSE INPUT;' in order to "discard" the current input-record.


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