Date:  Mon, 21 Jun 2010 21:41:22 0400 
ReplyTo:  OR Stats <stats112@GMAIL.COM> 
Sender:  "SAS(r) Discussion" <SASL@LISTSERV.UGA.EDU> 
From:  OR Stats <stats112@GMAIL.COM> 
Subject:  Data Step & macro array 
ContentType:  text/plain; charset=ISO88591 

Hello:
I have a user defined table like this
id x1 x2 ... x10
For each id, I have a macro variable _macrovarI with p number of terms. For
example, for id=1
%put &_macrovar;
x1 x2*x8 x3 x5
where in this case p=4 terms. For each one of the p terms I have p
coefficients corresponding to each of the terms in a table
term coeff
x1 c1
x2*x8 c2
x3 c3
x5 c5
From the original userdefined table, I would like to create a new column
y that is the sum of the products of the terms and their corresponding
coeff's. For example, for id=1
y= c1*x1 + c2*x2*x8 + c3*x3 + c4*x5
Two things that have been tricky are that in the original dataset. For one
thing, I don't have column that are product of the x's (for example,
x2*x8). And the second thing that makes this complicated is that for each
id, the p terms changes and therefore the coefficient table changes with
them. How do I create a new table that is
id x1 .... x10 y
Data newtable;
set origtable;
/*loop thru p terms? for each id*/
Many thanks!
Side note: The macro variable is output from a model proc as is the
coefficient table. I need to to apply the output x's and their coefficients
to new dataset, which the proc does not allow for to calculate y.
