BookmarkSubscribeRSS Feed
model_coder
Calcite | Level 5

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.

3 REPLIES 3
SteveDenham
Jade | Level 19

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

model_coder
Calcite | Level 5

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.

SteveDenham
Jade | Level 19

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1813 views
  • 0 likes
  • 2 in conversation