【问题标题】:Proc logisitic gives error when column not present in the model当模型中不存在列时,Proc 逻辑会给出错误
【发布时间】:2016-12-06 19:54:41
【问题描述】:

我正在尝试运行 proc 逻辑回归。我有很多以“ST”和“RF”开头的预测器。所以我这样写了模型声明

proc logistic data=x outest=y;
   model binary_variable (event='1')= age sex RF:  ST: lackfit;
  output out=x p=fitted_prob predprob=individual ;
run;

我在一个宏中输入了这个语句,并在多个场景中运行这个宏。我遇到了几个没有以ST开头的列的数据集,并且proc逻辑抛出了一个错误,如下所示

WARNING: No variables found beginning with 'ST' in data set
NOTE: The SAS System stopped processing this step because of errors.

是否有办法处理此类异常? proc 逻辑中的某种参数?谢谢!

【问题讨论】:

    标签: exception sas


    【解决方案1】:

    在您的宏中,添加一些逻辑来检测每个输入数据集是否包含任何以这些前缀开头的列,并且仅当至少存在一个这样的列时才将相应的通配符添加到模型语句中。您可以从 sashelp.vcolumn 或 proc sql 等效项 dictionary.columns 获取此信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多