LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 1999, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 6 Dec 1999 13:14:36 -0500
Reply-To:   Y.Huang@ORGANONINC.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ya Huang <Y.Huang@ORGANONINC.COM>
Subject:   Re: CrossProduct Array question
Comments:   To: JGerstle@SW.UA.EDU
Content-type:   text/plain; charset="iso-8859-1"

You are on the right track, only thing need is to declare another array:

array prod (43) p1-p43;

Ya Huang Organon Inc.

> -----Original Message----- > From: JGerstle@SW.UA.EDU [mailto:JGerstle@SW.UA.EDU] > Sent: Monday, December 06, 1999 1:00 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: CrossProduct Array question > > > 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); > end; > etc.. > > 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 > macros? > > > John Gerstle > Program Analyst, Sr. > Applied Gerontology Program > University of Alabama >


Back to: Top of message | Previous page | Main SAS-L page