我尝试在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 :(得分: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;