创建决策树时出错

时间:2017-12-26 15:16:38

标签: sas decision-tree

我想用sas程序 hpsplit 创建关于此数据的树决策:

 | city       | studied_area     | salary |
 ------------------------------------------
1| manchester | biology          | 40000  |
2|  london    | computer science | 50000  |
3| reading    | computer science | 45000  |

每一行代表一个人。变量是获得学位的城市,研究区域和实际工资。

我想使用前两个变量来创建一个决策树来猜测薪水变量。

我开始这样做:

proc hpsplit data=lib1.wagesdata seed=15531;
class salary city studied_area;
model salary = city studied_area;
grow entropy;
prune costcomplexity;
run;

我使用了这个文档:https://support.sas.com/documentation/onlinedoc/stat/141/hpsplit.pdf

但我有以下错误:

ERROR: Character variable appeared on the MODEL statement without appearing on a CLASS statement.
ERROR: Unable to create a usable predictor variable set.

你能解释一下为什么以及如何解决这个问题?

更新:只需在class子句中添加所有变量,以避免出现奇怪的错误,因为在第一个示例中并非如此。 我为工资添加了一种格式,因为输出是不可理解的。

0 个答案:

没有答案
相关问题