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燈, 水草

請輸入看板名稱,例如:Tech_Job站內搜尋

TOP