Statistics 板


LINE

我用SAS跑虚拟变项的回归,程式码如下 DATA M2; INPUT region x1 x2 y @@; CARDS; 4 8863164 184230 23677 ...... (输入440笔资料後) ; RUN; /*分region跑回归*/ PROC SORT data=M2 out=sort_M2; BY region; RUN; Proc reg data=sort_M2; BY region; Model y=x1 x2; RUN; /*产生dummy变项,region从4个变成3个*/ DATA M2_dummy; set work.M2; if region=1 then D1=1 else D1=0; if region=2 then D2=1 else D2=0; if region=3 then D3=1 else D3=0; RUN; proc freq data=M2_dummy; tables region*D1*D2*D3/List; Run; 结果只有跑出分region的结果,dummy失败。 SAS出现结果: 1 DATA M2; 2 INPUT region x1 x2 y @@; 3 CARDS; NOTE: 当 INPUT 陈述式延伸超过行尾时,SAS 跳到了新的一行。 NOTE: The data set WORK.M2 has 440 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 444 ; 445 RUN; 446 447 448 PROC SORT data=M2 out=sort_M2; 449 BY region; 450 RUN; NOTE: There were 440 observations read from the data set WORK.M2. NOTE: The data set WORK.SORT_M2 has 440 observations and 4 variables. NOTE: PROCEDURE SORT used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 451 Proc reg data=sort_M2; NOTE: 正在写入 HTML Body (本文) 档案: sashtml.htm 452 BY region; 453 Model y=x1 x2; 454 RUN; NOTE: 已透过 BY 处理停用互动性。 NOTE: PROCEDURE REG used (Total process time): real time 2.99 seconds cpu time 1.03 seconds 455 456 DATA M2_dummy; 457 set work.M2; 458 if region=1 then D1=1 else D1=0; ---- 388 202 459 if region=2 then D2=1 else D2=0; ---- 388 202 460 if region=3 then D3=1 else D3=0; ---- 388 202 ERROR 388-185: Expecting an arithmetic operator. ERROR 202-322: The option or parameter is not recognized and will be ignored. 461 RUN; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.M2_DUMMY may be incomplete. When this step was stopped there were 0 observations and 7 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 462 proc freq data=M2_dummy; 463 tables region*D1*D2*D3/List; 464 Run; NOTE: No observations in data set WORK.M2_DUMMY. NOTE: PROCEDURE FREQ used (Total process time): real time 0.00 seconds cpu time 0.01 seconds 请问我的dummy为什麽会跑不出来? 还是说我从第二部份就开始写错了呢? 谢谢>///< --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.92.139 ※ 编辑: aswind0614 来自: 140.112.92.139 (12/04 17:22)
1F:推 tew:共线性吧 12/04 22:38
2F:推 JKY:458 ~ 460有说明错误 12/04 23:01
3F:推 imaltar: if region=1 then D1=1 後要加分号(;) 再用ELSE 12/04 23:03
4F:→ BugEater:在sas里面不需要做dummy的,用class就可以。 12/05 07:35
5F:→ aswind0614:谢谢楼上各位大大!我跑出来了:) 12/05 22:10







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:iOS站内搜寻

TOP