2014-05-02 41 views
0

这里是我使用的变量选择代码:是否可以在elasticnet(SAS)中使用'where'语句?

proc glmselect data=abct; 
    where incex1=1; 
    title 'GLMSELECT with Elastic Net'; 
    model devmood_c = asetot age yrseduc sex employyn cohabyn caucyn asitot penntot 
        anxdis ahealthuse ahospit ventxpwk acmn nhospit bmi comorb 
        aqllimmn aqlsubmn aqlsympmn aqlemotmn aqlenvirmn aqltotmn 
        smoke3gp nalcwkcurr 
        /selection=elasticnet(steps=120 L2=0.001 choose=validate); 
run; 

的问题是,当我运行它,它告诉我:

ERROR: Variable incex1 is not on file WORK.ABCT.

incex1变量用于排除人我们的数据库在特定问题上得分太高。它适用于LASSO,但即使代码相似,似乎也不能与elasticnet一起使用。

是否有人知道我可以如何使用它,或者如果有另一种方法来排除在调查问卷中打分低于某个阈值的患者?

这是incex1是如何被编码:

if devmood_c = 0 then incex1=1; 
if devmood_c = 1 then incex1=1; 
if devmood_c = . then incex1=0; 
if bdisev > 2 then incex1=0; 
label incex1 = "1=no mood at baseline or BDI > 20, 0=excluded"; 
+0

我不明白为什么它不适用于'proc glmselect'。你确定它存在与'work.abct'上的名字吗?那个错误表明它没有。如果'where'是非法的(不太可能),它应该给出另一个错误,除非'proc glmselect'中的建模有特殊之处。您可以尝试将其添加为数据集标准:'data = abct(where =(incex1 = 1))'而不是以下来测试。 – Joe

+0

^乔说什么。有时它可能看起来好像列被命名为'incex1',但你实际看到的是列标签而不是列名。要仔细检查,请在Base SAS中打开表格,然后转到查看 - >列名称。我不确定EG在哪里。也许别人可以验证。 –

+0

在EG中,它通常是默认显示列名称,但是这会因地点而异;您可以在选项 - >数据 - >数据常规中取消选中“为列名使用标签”,或将鼠标悬停在标签/名称上,它应显示另一个。 – Joe

回答

1

这个工作在测试数据,所以它可能是与不具有你所期望的特性源数据的问题。例如,

ods graphics on; 
proc glmselect data=sashelp.Leutrain valdata=sashelp.Leutest 
       plots=coefficients; 
where x1>0; 
    model y = x2-x7129/ 
     selection=elasticnet(steps=120 l2=0.001 choose=validate); 
run; 

按预期工作。

+0

我同意。我也无法复制这一点。 – DomPazz

相关问题