&effects and &estimate are regression results stored in vector macro variables. As shown in the pictures above, &effects is the vector variable with the names of effects. &estimate are the vector of coefficients. say &effects is "a b c d e f g". &estimate is "1 2 3 4 5 6 7" How can I use these two macro variables to create a data step equation that equals to the dot product of the two vectors? Here's the code that I tried, but it did not produce the correct result. %do i=1 %to %sysfunc(countw(&effects)); %let effects&i = %scan(&effects, &i, %str( )); %end; %do i=1 %to %sysfunc(countw(&estimate)); %let estimate&i = %scan(&estimate, &i, %str( )); %end; %let total1=&effects1*estimate1; %let largeN=%sysfunc(countw(&effects)); %do i=2 %to %sysfunc(countw(&effects)); %let total&i = total%eval(&i-1).+&effects&i*&estimate&i; %end; %put &total&largeN; [<-this should be the yhat definition, it is an expression like a*1 + b*2 + c*3 + d*4 + e*5 + f*6 + g*7] data option2; set opion1; yhat=&total&largeN; [<-this equation should be the same as "yhat=a*1 + b*2 + c*3 + d*4 + e*5 + f*6 + g*7"] run; Can anyone help me to solve this problem? Thank you so much!
... View more