04-03-2013 05:15 AM
I have a simple OLS model where dep_var is regressed against predictors that include variables like x and y and also a one period lagged value of dep_var depicted as
lagged_dep_var = lag(dep_var);
The model is then defined as:
proc reg data = dep_var outest =model_out;
model dep_var = lagged_dep_var x y;
I am now trying to using proc score to predict future values and doesn't work. I can make the proc score if I remove the lagged variable from the OLS regression (However, that is not an option).
proc score data = projected_predictors score = model_out out = model_predictions type = parms predict;
var dep_var lagged_dep_var x y;
I would like to get thoughts here if there is a workaround.
04-03-2013 07:41 AM
What do you get when you invoke PROC SCORE with that syntax? Are there log messages, or does the output just not what is expected?
04-03-2013 08:08 AM
The proc score shows missing values for the dependent variable. I verified that my code is correct by removing the lagged variable from regression and proc score produces correct values. I have also made the code work by exporting regression coefficients and performing the calculations in a data step. However, I wanted to see if there is a cleaner way to perform the calculations.
04-03-2013 08:40 AM
When you examine the dataset that you want to score (projected_predictors), is the lagged variable correctly calculated? PROC SCORE is acting like one of the variables needed to create the predicted value is missing.
One work-around would be to append the dataset projected_predictors (assuming that the lagged variable is there and correctly calculated) to the dataset dep_var, making sure that the dependent variable dep_var in projected_predictors is set to missing (.). The dataset model obtained from the output statement should then have predicted values for all records with missing values of the dependent variable if you modify it to be
output out=model p=predicted stdp=stderr;
Message was edited by: Steve Denham