Hi,
I have attached herewith dataset and coding script in sas on demand. I am having diificult in running the below code, would appreciate if anybody can help me out;-
Tried with different ways as following but not working stilll:
Hi, Check out the documentation for the FOREST and HPFOREST procedures and make sure you have valid syntax for each of your statements. For example, you have this statement with the FOREST procedure:
TARGET Default_Flag / LEVEL=BINARY;
The only valid choices for the LEVEL= options are LEVEL=NOMINAL or LEVEL=INTERVAL. The error notes in the log can be hard to figure out, but this error is trying to tell you that LEVEL=BINARY isn't valid syntax:
ERROR 22-322: Syntax error, expecting one of the following: INTERVAL, NOMINAL.
Hi,
Used both Nominal & Interval but still facing same issue. Pls support
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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.