Date: Mon, 6 Dec 1999 11:59:43 -0600
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Subject: CrossProduct Array question
Content-type: text/plain; charset=US-ASCII
I have a quick question (SAS 6.12 via Win98).
I need to determine the products of 43 pairs of variables (i.e. c1*b1
, c2*b2 , ......etc... c43*b43 ). I was thinking that there should be
a way to do this without typing out every product as separate lines
in the data step. I'm thinking that if I were to create an array for
both sets of variables that there should be a way to multiply each
pair of variables. I tried it like this but to no avail:
array seta (43) c1 - c43;
array setb (43) b1 - b43;
do i = 1 to 43;
prod(i) = seta(i)*setb(i);
The message I get is:
ERROR: Undeclared array referenced: PROD.
ERROR: Variable PROD has not been declared as an array.
What I'd like is to get 43 separate variables calculated form the 43
products, each with its own name. Should I create a variable for
each step of the array calculations? Can I do this without using
Program Analyst, Sr.
Applied Gerontology Program
University of Alabama