Date: Fri, 23 May 2003 14:37:23 +0200
Reply-To: Braddock <gianluca.marchi@ITALY.ACNIELSEN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Braddock <gianluca.marchi@ITALY.ACNIELSEN.COM>
Organization: Centro Servizi Interbusiness
Subject: Do Loop
here we are to face another question about DO.
I want to detect non-missing values in the first row of a matrix and then
set the corresponding columns to missing for all the rows.
I start from this example:
So I have a 3x5 matrix. Non missing values for first row are at columns 1, 3
and 4. Now what I want is to assign missing values to all the first row
variables and to A4, in the second row, and to A1, A3 and A4 in the third.
I have written the following code:
array t (5) a1--a5;
p1=0; p2=0; p3=0; p4=0; p5=0;
array p (5) p1--p5;
do i=1 to dim(t);
if t(i)=1 then do;
keep p1--p5 j;
merge prova pos;
array a (*) a1--a5;
array p (*) p1--p5;
do i=1 to j;
put p(i) k j a(k) i;
I think you have dozen of better ideas about how to handle this problem (and
any suggestion would be appreciated), however my question is about the error
I get when SAS performs the last loop:
ERROR: Invalid DO loop control information, either the INITIAL or TO
expression is missing or the BY expression is missing, zero, or invalid.
I have no idea how to fix the problem, and you?
Thanks in advance