BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Bear85
Calcite | Level 5

In PROC HPGENSELECT, how to score the original dataset / append predicted values and residuals to the right? For example, the code below would produce OutDsn with only 2 columns (Pred1 and Resid1). And I'd like OutDsn = InDsn + 2 columns appended to the right of it? Thanks for the insights!

 

PROC HPGENSELECT data=inDsn FCONV=1E-8 MAXITER=500 ITSUMMARY;
CLASS Credit(ref = "A1") ;
MODEL Loss = Credit / dist= Gamma link=log;
WEIGHT ECD;
OUTPUT out=outDsn Predicted = Pred1 Residual = Resid1 ;
ODS OUTPUT ParameterEstimates= PEs;
RUN;
1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

Hello,

 

Two possibilities here :

 

1. Use an ID statement and then merge with original data.
The ID is the identifier for the observation.
PROC HPGENSELECT -- OUTPUT statement :

The variables in the input data set are not included in the output data set to avoid data duplication for large data sets; however, variables that are specified in the ID statement are included.

 

2. Use the CODE statement :

The CODE statement writes SAS DATA step code for computing predicted values of the fitted model either to a file or to a catalog entry. This code can then be included in a DATA step to score new data.

Use this score code to score your original data ! Original explanatory variables will be kept.

 

Kind regards,

Koen

View solution in original post

1 REPLY 1
sbxkoenk
SAS Super FREQ

Hello,

 

Two possibilities here :

 

1. Use an ID statement and then merge with original data.
The ID is the identifier for the observation.
PROC HPGENSELECT -- OUTPUT statement :

The variables in the input data set are not included in the output data set to avoid data duplication for large data sets; however, variables that are specified in the ID statement are included.

 

2. Use the CODE statement :

The CODE statement writes SAS DATA step code for computing predicted values of the fitted model either to a file or to a catalog entry. This code can then be included in a DATA step to score new data.

Use this score code to score your original data ! Original explanatory variables will be kept.

 

Kind regards,

Koen

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 214 views
  • 0 likes
  • 2 in conversation