夭妖 发表于 2010-5-20 11:15 
问题是这样的:我在A数据集中得到了回归模型,
怎么样把这个回归模型运用到其他数据集B上呢?
两个数据集的 列名设置为一样的,
但是,由于自变量比较多,不能手工输入,
所以请教一下大家~非常谢谢~
There are a couple of ways can think of.
1) set both dataset togather ....
2) use proc score ...
See example below.
data a(keep=y x:) b(keep=x:);
do i = 1 to 40;
x1=rannor(123); x2=rannor(123); x3=rannor(123); err= rannor(123);
y=1+1*x1+0.5*x2+0.3*x3+err;
if i <=30 then output a ;
else output b;
end;
run;
*** use proc reg while doing a regression;
data ab;
set a b;
run;
proc reg data=ab;
model y= x1 x2 x3;
output out=pred p=py;
run;
quit;
proc print data=pred; run;
****use proc score****;
proc reg data=a outest=parms;
model y= x1 x2 x3;
run;
quit;
proc score data=b score=parms out=bp predict type=parms;
var x1 x2 x3;
run;
proc print data=bp;
run;