2016-12-15 117 views
0

我試圖在SAS中運行邏輯迴歸模型最近幾個小時。但沒有運氣。有沒有語法錯誤?這裏是代碼:SAS:無法運行邏輯迴歸

options pageno=1 nodate; run; 

data SEATBELT; 
    input Belt $ Ejected $ Fatal $ Nonfatal $ Total; 
    datalines; 
Yes Yes 1105 14 1119 
Yes No 411111 483 411594 
No Yes 4624 497 5121 
No No 157342 1008 158350 
; 

proc logistic data=SEATBELT; 
    class Belt Ejected Fatal Nonfatal Total; 
    model Fatal/Total= Belt Ejected/selection = b sls=0.05; 
run; 

這是我得到的錯誤。

66   
67   proc logistic data=SEATBELT; 
68   class Belt Ejected Fatal Nonfatal Total; 
69   model Fatal/Total= Belt Ejected/selection = b sls=0.05; 
70   run; 

NOTE: The SAS System stopped processing this step because of errors. 
NOTE: The PROCEDURE LOGISTIC printed page 1. 
NOTE: PROCEDURE LOGISTIC used (Total process time): 
     real time   0.00 seconds 
     cpu time   0.00 seconds 

任何幫助將不勝感激。

感謝

回答

0

的PROC期待數值變量,你已經讀過您的數據作爲字符的部分。在FATAL和NONFATAL之後刪除$,以便它們以數字形式讀入。

CLASS語句是針對分類數據的,因此請從這裏除去EJECTED以外的變量。

我還建議在PARAM = Ref選項中添加它,以便它使用引用編碼。

data SEATBELT; 
    input Belt $ Ejected $ Fatal Nonfatal Total; 
    datalines; 
Yes Yes 1105 14 1119 
Yes No 411111 483 411594 
No Yes 4624 497 5121 
No No 157342 1008 158350 
; 

proc logistic data=SEATBELT; 
    class Belt Ejected/Param=REF; 
    model Fatal/Total= Belt Ejected/selection = b sls=0.05; 
run; 
+0

非常感謝!這工作! – user356923