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;
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
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
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.
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.
Ready to level-up your skills? Choose your own adventure.