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 (August 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 9 Aug 2001 13:19:45 -0400
Reply-To:   "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject:   Re: Read data with 0 observations
Comments:   To: "Ji, Xinyu (DPH)" <Xinyu.Ji@STATE.MA.US>
Content-Type:   text/plain

> From: Ji, Xinyu (DPH) [mailto:Xinyu.Ji@STATE.MA.US] > Hi, I have the following do loop: %LET TRANSCNT = 1; %DO %WHILE &TRANSCNT;%*TEST OCCURS HERE; %LET TRANSCNT = 0; > DATA _NULL_; > SET TRANSDATA NOBS = TRANS; %*RESET ONLY IF NOBS GT 0; > CALL SYMPUT('TRANSCNT', TRIM( LEFT(PUT(TRANS, 10.)) )); > STOP; > RUN; > %END;

> That is, in each iteration, a data set TRANSDATA is > generated. Repeat the do > loop until TRANSDATA has no observations. However, when > TRANSDATA actually > has zero observation, DATA _NULL_ step will end at "SET > TRANSDATA NOBS = > TRANS;" statement, and "CALL SYMPUT('TRANSCNT', TRIM( > LEFT(PUT(TRANS, 10.)) > ));" will not be executed. The previous TRANSCNT is not > overwritten, and the > do loop goes infinitely. Anyone could tell me how to fix the problem?

You understand the logic of the test correctly. I've added a couple lines that should keep it going only until NOBS=0;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov OpSys: Win_Pro Ver: 8.2 ---> cheerful provider of UNTESTED SAS code from the KludgeWrx !*! <---

remember perspective: the error is not always where it seems to occur! -- RJF2


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