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.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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