1

I am looking for a way to add labels to the predictors in a logistic regression procedure (aka proc logistic), so that in the result, I can read the labels instead of acronyms of the predictors.

I tried to add the labels in the data step, and then use the data set for modeling. However, the result is showing the attribute name instead of their labels. Here is my code.

Can someone help me? Thank you in advance!

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 $10.;
   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;
Counter10000
  • 525
  • 1
  • 8
  • 25

1 Answers1

1

Fellow stackflowers, I find a way. It is simple, add the parmlabel option in the logistic regression procedure (and course, you need to label the data in the data step first).

Here is the code:

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;
Counter10000
  • 525
  • 1
  • 8
  • 25