| Date: | Wed, 10 Apr 2002 11:35:25 -0700 |
| Reply-To: | yannifan <yannifan@ALUDRA.USC.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | yannifan <yannifan@ALUDRA.USC.EDU> |
| Organization: | University of Southern California |
| Subject: | a question about do loop |
| Content-Type: | TEXT/PLAIN; charset=US-ASCII |
|---|
Hi, I have a problem to run the following programs, the log screen telling
something wrong with the part of "sum(of s1-s(i))", that is what it
said--- ERROR: Missing numeric suffix on a numbered variable list (s1-s).
ERROR: Undeclared array referenced: NAME.
ERROR: Variable NAME has not been declared as an array.
ERROR 22-322: Syntax error, expecting one of the following: a name, ','.
Could you please tell me what is wrong?
My purpose is to find the fisrt "1" in the array--s(i) (the value of this
array is 1 or 0), and give the number of that item in the array to the
variable "numb". It would be great if you could give me some other
suggestions or idea to do that.
Thank you very much.
proc sort data=temp; by cntyid; run;
data temp2;
set temp;
by cntyid;
array s(12) screen1-screen12;
if s1=1 then numb=1;
do i=2 to 12;
if s(i)=1 and sum(of s1-s(i))=1 then numb=i;
end;
run;
|