BookmarkSubscribeRSS Feed
Adrian10
Calcite | Level 5

Hi all!

 

I need to force a variable in a decision tree. My code is the following:

 

proc hpsplit data = &lib..bds_vars maxdepth = 4 maxbranch = 4 nodestats=DT_1
target ind_default_7;

input risk_level/*the one whom is relevant*/ cliente_type/*the one I need to force*/  ;
code file="%sysfunc(pathname(work))/model_dtree.sas"; 
rules file="C:\Users...\Results\rules_dtree.txt";
output importance = imporvar; 
run;

NOTE. the criterion choosen is ENTROPIA (SAS default criterion)

 

Thanks a lot,

AP

1 REPLY 1
H
Pyrite | Level 9 H
Pyrite | Level 9

I don't have a direct solution for you. I was personally trying to force a certain tree to be used. Of note, the leaves option below will create a tree with set number of terminal nodes, not sure that may help you or others. Also, a weird way to force a split in,  may be to just split your data into two sets and fit two trees. But I am sure that probably won't address what you are trying to do.

 

 

prune costcomplexity (leaves=10);

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is ANOVA?

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.

Discussion stats
  • 1 reply
  • 2809 views
  • 2 likes
  • 2 in conversation