我正在寻找一种方法,在逻辑回归程序(又名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 $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;
斯塔克弗劳尔斯兄弟,我找到了一条路。很简单,添加 parmlabel 逻辑回归过程中的选项(当然,您需要首先标记数据步骤中的数据)。
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;