Date: Thu, 19 Apr 2007 09:31:33 -0700
Reply-To: shiling99@YAHOO.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Shiling Zhang <shiling99@YAHOO.COM>
Organization: http://groups.google.com
Subject: Re: Residuals and predicted values
In-Reply-To: <200704191535.l3JEIZdr002329@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="iso-8859-1"
On Apr 19, 11:35 am, mcolowa...@YAHOO.CO.UK wrote:
> proc sort data=CALENDAR.c2003fnm2f;
> by cyear;
> run;
>
> *EXCLUDE EMPPROP;
> ods exclude testanova acovtestanova;
> Hi
>
> I use the following code to estimate Fama MacBeth regressions and would
> also like to get the residuals and predicted values in the output. When I
> specify r p after the model statement it doesn't work. Do you have any
> suggestions that would enable me to get the same output as specified in the
> code plus the residuals and predicted values?
> proc sort data=data;
> by cyear;run;
> proc reg data = data outest=coef1 adjrsq tableout;
> model y= i o/acov r p;
> i: test i;
> o: test o;
> BY cyear;
> ods output acovtestanova=actest;
> run;
> quit;
>
> Thanks
I think you need add
output out=<dsn> p=y_hat r=err;
in proc reg as below. The t2 data set will contain both predicted
values and error terms.
HTH
data t1;
do i =1 to 20;
x=rannor(1234567);
y=1+x+rannor(1234567);
output;
end;
run;
proc reg data=t1;
model y=x;
output out=t2 p=y_hat r=err;
run;
quit;
proc print data=t2;run;