Piggy backing off my last post titled, "Proc Optmodel - Minimize Mean Absolute Error". I'm adding another constant to smooth for trend, but need to add in another equation. In the below code, I have two implicit variables, b and forecast, that are used to optimize a and y. When I run the code, I get the follow error: "The symbol 'forecast' is unknown. This occurs on the "impvar b" step. How do I make the two implicit variable equations compatible with each other since they need to be equating simultaneously? Thank you. data _null_; if 0 then set example_data2 nobs=n; call symputx('nrows',n); stop; run; %put &nrows.; proc optmodel; set <str,num> MASTER_DATES; set MASTER = setof {<i,t> in MASTER_DATES}i; set NROW = setof {<i,t> in MASTER_DATES}t; num performance {MASTER_DATES}; num month {MASTER_DATES}; read data example_data2 into MASTER_DATES=[master_nbr nrow] performance month; var a >=0 <=1; var y >=0 <=1; impvar b{<i,t> in MASTER_DATES} = if <i,t-1> in MASTER_DATES then ((forecast[i,t] - forecast[i,t-1])* y) + ((1 - y) * b[i,t-1]) else (performance[i,t+(&nrows.-1)] - performance[i,t]) / (&nrows. - 1); impvar forecast{<i,t> in MASTER_DATES} = if <i,t-1> in MASTER_DATES then (performance[i,t]*a) + ((1 - a) * (forecast[i,t-1] + b[i,t-1])) else performance[i,t]; impvar sae{<i,t> in MASTER_DATES} = abs(performance[i,t] - forecast[i,t]); impvar ape{<i,t> in MASTER_DATES} = if <i,t-1> in MASTER_DATES then abs(sae[i,t] / performance[i,t]) else 0; min mae = (sum {<i,t> in MASTER_DATES} sae[i,t]) / (&nrows. -1); solve; print a y; create data optmodel_outdata2 from a y mae; create data optmodel_outdata from [master_nbr nrow] performance month b forecast sae ape; quit;
... View more