|
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
|