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 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 1 Aug 2003 13:30:17 -0700
Reply-To:   cassell.david@EPAMAIL.EPA.GOV
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV>
Subject:   Re: Why is the value of do variable not being restricted?
Content-type:   text/plain; charset=us-ascii

ma015 b8234 <ma015b8234@BLUEYONDER.CO.UK> wrote: > I am running this data step and doing array processing. > The value of do variable is not being restricted by last.variable; > Can anyone tell me what is going on here? > > Data cr_ass.Comms_unique1; > set cr_ass.Comms_unique; > by SAP_ID; > Array comm(10) $12 Comm_No1-Comm_No10; > Do i=1 by 1 until (last.SAP_ID) ; > Comm(i)=Comm_no; > end; > run;

Hmmm. You have a SET and a BY statement, but your array has no other inputs. It looks you are (accidentally) writing the same value into every element of the array until you overflow the boundary. This is because you are *not* reading any new records in while you are in the DO loop.

At a guess (a wild guess at that) you wanted to perform a DOW-loop and accidentally left the code in the form of the traditional SAS implicit loop instead. Perhaps you want something more like:

data cr_ass.Comms_unique1; array comm(10) $12 Comm_No1-Comm_No10; do i=1 by 1 until (last.SAP_ID); set cr_ass.Comms_unique; by SAP_ID; comm(i)=Comm_no; end; run;

If all you want is to turn your comm_no values into a row of comm_noX values, then you could do this in PROC TRANSPOSE instead.

HTH, David -- David Cassell, CSC Cassell.David@epa.gov Senior computing specialist mathematical statistician


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