## How do predict y at different x values using Proc Loess?

Solved
Occasional Contributor
Posts: 5

# How do predict y at different x values using Proc Loess?

Hi,

I'm using Y values (0, 4.495, 5.099, 6.055, 6.168, 3.449, 3.296, 0, 2.046) collected at different X values (0, 4, 7, 11, 14, 21, 28, 35, 39) in Proc Loess.

The predicted values I get (smooth = 0.75, degree= 2) are for the X values above. But, I am interested in different X values within the original. For example, what would be the predicted Y at X = 3?

I can't figure out how to obtain that from Proc Loess... Does anyone know how to do that?
Thanks, Nick

Accepted Solutions
Solution
‎05-14-2014 11:31 AM
Posts: 5,528

## Re: How do predict y at different x values using Proc Loess?

Sorry about that. You must also use the SCORE statement and ODS OUTPUT to get what you want

proc loess data=myData;

model...;

...

score;

ods output ScoreResults=myPreds;

run;

Or you could use a separate dataset with only the X coordinates of the predictions you want.

PG

PG

All Replies
Posts: 5,528

## Re: How do predict y at different x values using Proc Loess?

PG
Occasional Contributor
Posts: 5

## Re: How do predict y at different x values using Proc Loess?

PGStats, thanks for the prompt response...

That didn't work... According to the documentation, "PROC LOESS deletes any observation with missing values...".

Would you have any other idea? Thanks, Nick

Solution
‎05-14-2014 11:31 AM
Posts: 5,528

## Re: How do predict y at different x values using Proc Loess?

Sorry about that. You must also use the SCORE statement and ODS OUTPUT to get what you want

proc loess data=myData;

model...;

...

score;

ods output ScoreResults=myPreds;

run;

Or you could use a separate dataset with only the X coordinates of the predictions you want.

PG

PG
Occasional Contributor
Posts: 5

## Re: How do predict y at different x values using Proc Loess?

PGstats, thanks for your help! That was great... I was starting to get disappointed for not being able to do that.. Thanks! Nick

SAS Super FREQ
Posts: 4,241

## Re: How do predict y at different x values using Proc Loess?

PG's advice is known as "the missing value trick." See  The missing value trick for scoring a regression model - The DO Loop   Somewhere in the 9.3-9.3 time frame, PROC LOESS added an OUTPUT statement which enables you to get predicted values for observations which have a missing response but nonmissing values for the explanatory variable.

In general, there are five ways to score a regression model, see: Techniques for scoring a regression model in SAS - The DO Loop

Of the techniques in the second article, PROC LOESS only supports the SCORE statement, which PG has shown you how to use.

🔒 This topic is solved and locked.