Programming the statistical procedures from SAS

Need help in using proc score with proc reg

Reply
Contributor
Posts: 21

Need help in using proc score with proc reg

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;

    output out=model;

run;

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;

run;

quit;

I would like to get thoughts here if there is a workaround.

Respected Advisor
Posts: 2,655

Re: Need help in using proc score with proc reg

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?

Steve Denham

Contributor
Posts: 21

Re: Need help in using proc score with proc reg

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.

Respected Advisor
Posts: 2,655

Re: Need help in using proc score with proc reg

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;

Steve Denham

Message was edited by: Steve Denham

Ask a Question
Discussion stats
  • 3 replies
  • 551 views
  • 0 likes
  • 2 in conversation