全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
6853 2
2013-12-06
本人想用sas做多重线性回归,就是一个y多个x的那种,自变量中有些是分类变量,请教大侠怎么在程序中设置哑变量?

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-12-7 01:24:52
data coding;
set sample;

x1_h = ( x1 in ('GGG','TTT'));
X2_H = ( X2 > 2200);
RUN;

X1_h is the dummy variable when x1 has character values.  X2_h is the dummy variable when x2 has numerical values. The max and min values of x1_h/x2_h is 1 and 0. You can create dummy variables like these based on the values of x variables.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2013-12-8 07:11:41
melody21 发表于 2013-12-7 01:24
data coding;
set sample;
You can consider using glmmod procedure to code the dummy automatically like SAS GLM procedure does.

Here is an example to illustrate this concept.

proc print data=sashelp.class;
run;

data class;
  set sashelp.class;
  id=_N_;
  run;

proc glmmod data=class outdesign=out  noprint;
class age ;
model id=age ;
run;

proc print data=out label;
run;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群