turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Need help in using proc score with proc reg

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

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;

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

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?

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

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;

Steve Denham

Message was edited by: Steve Denham