Date: Thu, 23 Jun 2005 08:05:47 +0000
Reply-To: Guido T <cymraeg_erict@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Guido T <cymraeg_erict@HOTMAIL.COM>
Subject: Re: Array problem
Content-Type: text/plain; format=flowed
... wood for trees ...(sigh). I think just defining the array "the other way
round", would have been a *better* thing to do. Then the loop can go in the
normal, incrementing, way. But there's no big difference (6 fewer
characters), so long as the first non-zero element of the array is the one
Well, it was the first thing in the morning and I hadn't finished my coffee
>From: David Neal <afdbn@UAA.ALASKA.EDU>
>Reply-To: David Neal <afdbn@UAA.ALASKA.EDU>
>Subject: Re: Array problem
>Date: Wed, 22 Jun 2005 23:56:03 -0800
>Stepping backwards through the array is probably a better way to do this
>the one I suggested, unless you are going to be doing other calculations
>such as creating a variable for total due etc. With a huge number of
>observations you would probably want to optimize as much as possible.
>Guido T wrote:
>>Given that you have you data in one record there are a number of things
>>One I would suggest looping down and lexit the loop when you find the
>>You could use something like this ...
>> do i=dim(testArray) to 1 by -1;
>> if testArray[i] le 0 then continue;
>> myTestVar = testArray[i];
>> CONTINUE goes to the bottom of the DO loop.
>> LEAVE goes to the first statement after the DO block.
>>Or perhaps ...
>> do i=dim(testArray) to 1 by -1 until(testArray[i] gt 0);
>> if i>0 then myTestVar = testArray[i];
>>Not that I would ever code anything like this.