Hi Robpratt My problem is on maximizing the correlation with PROC OPTMODEL. I am new to Proc optmodel. In your one of the previous post in the year 2012 subject line is Proc OptModel Help on Maximize Correlation), you had provided the solution. When i tried running the same code in SAS 9.4, I am getting an error message. could you please help on the same following are the data and code data cor; input org dep; cards; 11785895 7.42 2335492 7.58 2345245 7.58 2392912 7.53 12755890 7.63 2918402 7.67 2773183 7.68 2824198 7.65 12263433 7.53 ; run; proc optmodel; set w; number org{w}; number ads{w}; number dep{w}; var s{w} >= 0 <= .8 init 1; read data cor into w = [_n_] org dep; impvar ads {i in w} = org * s; max correlation = (10*sum{i in w}(ads*dep) - (sum{i in w}(ads)) * (sum{i in w}(dep))) / (sqrt(10*sum{i in w}(ads^2) - (sum{i in w}(ads))^2) * sqrt(10*sum{i in w}(dep^2) - (sum{i in w}(dep))^2)); solve; print s correlation; quit; Log message after running the code 96 proc optmodel; NOTE: Writing HTML Body file: sashtml20.htm 597 set w; 598 number org{w}; 599 number ads{w}; 600 number dep{w}; 601 var s{w} >= 0 <= .8 init 1; 602 read data cor into w = [_n_] org dep; NOTE: There were 9 observations read from the data set WORK.COR. 603 604 impvar ads {i in w} = org * s; --- --- 517 614 ERROR 517-782: The name 'ads' is already declared. ERROR 614-782: The name 'org' is an array. 604! impvar ads {i in w} = org * s; - 614 ERROR 614-782: The name 's' is an array. 605 606 max correlation = (10*sum{i in w}(ads*dep) - (sum{i in w}(ads)) * (sum{i in w}(dep))) --- --- 614 614 ERROR 614-782: The name 'ads' is an array. 606! max correlation = (10*sum{i in w}(ads*dep) - (sum{i in w}(ads)) * (sum{i in w}(dep))) --- --- 614 614 ERROR 614-782: The name 'dep' is an array. 607 / (sqrt(10*sum{i in w}(ads^2) - (sum{i in w}(ads))^2) * sqrt(10*sum{i in w}(dep^2) - --- --- 614 614 ERROR 614-782: The name 'ads' is an array. 607! / (sqrt(10*sum{i in w}(ads^2) - (sum{i in w}(ads))^2) * sqrt(10*sum{i in w}(dep^2) - --- --- 614 614 607! (sum{i in w}(dep))^2)); ERROR 614-782: The name 'dep' is an array. 608 solve; NOTE: Problem generation will use 4 threads. NOTE: Previous errors might cause the problem to be resolved incorrectly. NOTE: The problem has 9 variables (0 free, 0 fixed). NOTE: The problem has 0 linear constraints (0 LE, 0 EQ, 0 GE, 0 range). NOTE: The problem has 0 nonlinear constraints (0 LE, 0 EQ, 0 GE, 0 range). NOTE: The OPTMODEL presolver is disabled for linear problems. WARNING: No objective has been specified. A constant zero objective will be used. NOTE: The problem is a pure network instance. The ALGORITHM=NETWORK option is recommended for solving problems with this structure. NOTE: The LP presolver value AUTOMATIC is applied. NOTE: The LP presolver removed all variables and constraints. NOTE: Optimal. NOTE: Objective = 0. 609 print s correlation; ERROR: The symbol 'correlation' has no value at line 609 column 9. 610 quit; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE OPTMODEL used (Total process time): real time 1.71 seconds cpu time 0.79 seconds Could you please look into that. thanks Ajit
... View more