I have a dataset that has three variables, say y, x and group. I need to do regression of y on x within each group, and output the predicted along with variables y, x, groups into one dataset. If there are only two groups, I can do it like:
proc reg data=a; where group=1; Model y= x; OUTPUT out=c1 P=PRED ; run; quit;
proc reg data=a; where group=2; Model y= x; OUTPUT out=c2 P=PRED ; run; quit; data combine; set c1 c2; run; But in fact I have 200 groups, I am asking if there is an easy & smart way to do that?
Thanks
Dale


雷达卡


京公网安备 11010802022788号







