如何在 SAS Logistic 回归过程中添加标签

How to Add Labels in SAS Logistic Regression Procedure

我正在寻找一种在逻辑回归过程(又名 proc logistic)中为预测变量添加标签的方法,以便在结果中,我可以读取标签而不是预测变量的首字母缩写词。

我尝试在数据步骤中添加标签,然后使用数据集进行建模。但是,结果显示的是属性名称而不是它们的标签。这是我的代码。

有人可以帮助我吗?提前致谢!

data Crops;
   length Crop $ 10;
   infile datalines truncover;
   input Crop $ @@;
   do i=1 to 3;
     input x1-x4 @@;
     if (x1 ^= .) then output;
   end;
   input;
  label Crop='Important plant';
   label x1='length';
   label x2='width';
   label x3='darkness';
   label x4='time';

   datalines;
Corn       16 27 31 33  15 23 30 30  16 27 27 26  
Corn       18 20 25 23  15 15 31 32  15 32 32 15  
Corn       12 15 16 73  
Soybeans   20 23 23 25  24 24 25 32  21 25 23 24  
Soybeans   27 45 24 12  12 13 15 42  22 32 31 43  
Cotton     31 32 33 34  29 24 26 28  34 32 28 45  
Cotton     26 25 23 24  53 48 75 26  34 35 25 78  
Sugarbeets 22 23 25 42  25 25 24 26  34 25 16 52  
Sugarbeets 54 23 21 54  25 43 32 15  26 54  2 54  
Clover     12 45 32 54  24 58 25 34  87 54 61 21  
Clover     51 31 31 16  96 48 54 62  31 31 11 11  
Clover     56 13 13 71  32 13 27 32  36 26 54 32  
Clover     53 08 06 54  32 32 62 16  
;

proc contents data=Crops varnum; run;
proc means data=Crops n nmiss; run;

ods graphics on;
proc logistic data=Crops plots(only)=effect(x=x1);
   model Crop=x1-x4 / link=glogit;
   score out=Score1;
run;
ods graphics off;

proc logistic data=Crops outmodel=sasuser.CropModel;
   model Crop=x1-x4 / link=glogit;
   score data=Crops out=Score2;
run;

proc logistic inmodel=sasuser.CropModel;
   score data=Crops out=Score3;
run;

data Prior;
   length Crop .;
   input Crop _PRIOR_;
   datalines;
Clover     11
Corn        7
Cotton      6
Soybeans    6
Sugarbeets  6
;
proc logistic inmodel=sasuser.CropModel;
   score data=Crops prior=prior out=Score4 fitstat;
run;

stackflowers的小伙伴们,我有办法了。很简单,在逻辑回归过程中添加parmlabel选项(当然,你需要先在数据步骤中标记数据)。

代码如下:

ods graphics on;
proc logistic data=Crops plots(only)=effect(x=x1);
   model Crop=x1-x4 / link=glogit parmlabel;
   score out=Score1;
run;
ods graphics off;

proc logistic data=Crops outmodel=sasuser.CropModel;
   model Crop=x1-x4 / link=glogit parmlabel;
   score data=Crops out=Score2;
run;