Hi,
You are getting errors because your syntax is incorrect.
Maybe you are thinking Proc Forest and Proc HPForest use the same syntax, but they don't.
For the first procedure, the following program should work:
PROC FOREST DATA=casuser.credit_modeling_sampling NTREES=100 SEED=12345; TARGET Default_Flag / LEVEL=NOMINAL; INPUT Income Loan_Amount Interest_Rate Debt_to_Income_Ratio Delinquency_History / LEVEL=INTERVAL; OUTPUT OUT=CASUSER.rf_preds; RUN;
You must use LEVEL=NOMINAL in the target statement when fitting a binary target in Proc Forest.
I also removed the OOBPREDICT statement because it doesn't exist, and I don't know what your intention was by using it.
The NTREES and SEED options should be placed in the Proc Forest statement.
There is no PREDICTED option in the output statement, so I removed it, but rf_preds already contains the predicted probabilities if that is what you are looking for.
In the second procedure, you are using Proc HPForest, so the syntax is different. This program should work for the sample data you provided:
PROC HPFOREST DATA=casuser.credit_modeling_sampling MAXTREES=100 SEED=12345; TARGET Default_Flag / LEVEL=BINARY; /* Specify the binary target */ INPUT Income Loan_Amount Interest_Rate Debt_to_Income_Ratio Delinquency_History / LEVEL=INTERVAL; /* Specify input variables */ /* Optional: for scoring output */ SCORE OUT=rf_preds; RUN;
You should use MAXTREES instead of NTREES in the Proc HPForest statement.
Unlike Proc Forest, Proc HPForest uses LEVEL=BINARY .
There is no OUTMODEL option in Proc HPForest. You could use the SAVE statement as a replacement, but it is not exactly the same thing.
The third procedure is very similar to the second one, but you should insert the TRAINFRACTION option in the Proc HPForest procedure:
PROC HPFOREST DATA=casuser.credit_modeling_sampling MAXTREES=100 SEED=12345 trainfraction=0.6;
I hope this explanation helps you achieve your goal.
I'd also recommend you take a look at the Forest and HPForest documentation. It contains relevant information regarding the syntax.
... View more