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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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