全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1560 3
2016-02-19
大家好,我现在有以下两段代码:第一张是原始代码,第二张是整理后的代码,我现在要做的是写出一段代码,可以由第一张转换成第二张的内容(比如怎样可以一下子把所有行的[ 模式: 1 ] => 1.0 去掉,这样不用手动一个一个改,怎样可以同时把if then do同时在每行都加上,并可以把大写字母替换成中文),我想写出一段代码可以由原始的转化成整理后的,因为手动一个一个改动太麻烦,谢谢!

1.
SCOR <= 468.500 [ 模式: 1 ]
SCOR <= 400 [ 模式: 1 ] => 1.0
SCOR > 400 [ 模式: 1 ]
A <= 100,000 [ 模式: 1 ]
B <= 6770.800 [ 模式: 1 ]
C <= 6,000 [ 模式: 1 ] => 1.0
C > 6,000 [ 模式: 1 ]
D <= 35 [ 模式: 1 ]
E<= 15 [ 模式: 1 ]
F <= 2 [ 模式: 1 ]
G<= 29.500 [ 模式: 1 ] => 1.0
G> 29.500 [ 模式: 1 ] => 1.0
F > 2 [ 模式: 1 ] => 1.0
E > 15 [ 模式: 1 ] => 1.0
D > 35 [ 模式: 1 ] => 1.0
B> 6770.800 [ 模式: 1 ] => 1.0
A> 100,000 [ 模式: 1 ] => 1.0

2.
if SCOR <= 468.500 then do;                                                                               
        if SCOR <= 400 then do;end;                                                                       
        if SCOR > 400 then do;                                                                        
                if A <= 100,000 then do;                                                               
                        if B<= 6770.800 then do;                                                        
                                if C <= 6,000 then do;end;                                               
                                if C > 6,000 then do;                                               
                                        if D <= 35 then do;                                       
                                                if E<= 15 then do;                               
                                                        if F <= 2 then do;                       
                                                                if G<= 29.500 then do;end;                
                                                                if G> 29.500 then do;end;                
                                                        end;                       
                                                        if F > 2 then do;end;                       
                                                end;                               
                                                if E> 15 then do;end;                               
                                        end;                                       
                                        if D > 35 then do;end;                                       
                                end;                                               
                        end;                                                       
                        if B> 6770.800 then do;end;                                                       
                end;                                                               
                if A > 100,000 then do;                                                               
        end;                                                                       
end;                                                       
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-2-21 08:48:15
你这些节点是怎么产生的呢?看起来像决策树。EM应该有产生编码的功能吧。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-2-21 11:15:08
kunkunred 发表于 2016-2-21 08:48
你这些节点是怎么产生的呢?看起来像决策树。EM应该有产生编码的功能吧。
这是决策树自动生成的,我现在就是想通过一段代码由1变为2(把[ 模式: 1 ] => 1.0 这些没用的字段都去掉,再加上if then do),可是好难写啊
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-2-23 04:38:13
3232442590 发表于 2016-2-21 11:15
这是决策树自动生成的,我现在就是想通过一段代码由1变为2(把[ 模式: 1 ] => 1.0 这些没用的字段都去掉, ...
I haven't used EM for a long time, but I remember that after you grow the tree, you can create a piece of code that can be run in base SAS as mentioned in the following link, which should be what you wanted.

17. Examine the Score Code. From the main menu, select View  [arrow]  Scoring . You will notice these entries:
    SAS Code, also known as Publish Score Code, is the SAS score code that you can use to score data in applications that run outside the Enterprise Miner environment.
http://support.sas.com/documenta ... .htm#a003124480.htm
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群