Date: Thu, 13 Jan 2000 11:33:41 -0800
Reply-To: David Cassell <cassell@MERCURY.COR.EPA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David Cassell <cassell@MERCURY.COR.EPA.GOV>
Organization: OAO Corp.
Subject: Re: REgression output
Content-Type: text/plain; charset=us-ascii
Paige Miller wrote:
> N Yiannakoulias wrote:
> > I am using SAS 6.12 and I'd like to generate an output of R^2 and parameter estimates (and
> > their standard errors) to a new data set.
> > But how do I do this with regression output?
> Look in the on-line HELP for PROC REG under the OUTEST option. This
> gives you the parameter estimates in a SAS data set. R-squared is output
> only if you use the option SELECTION=RSQUARE.
You can get R-squared if you use any of the options
But these options will give you *lots* of output, since you may get
a lot of possible models. This may also eat up a lot of CPU [a friend
of mine once crushed a VAX 750 with SELECTION=RSQUARE on a large dataset
with many independent variables].
Here's a dirty work-around. Assume you have 14 independent variables
to place in the MODEL statement. Then do this [and change the lowercase
parts to your own case]:
PROC REG DATA=whatever OUTEST=outfile;
MODEL y = x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 /
SELECTION=RSQUARE RSQ B START=14 ;
By setting the START= to the number of independent variables, you get
only one run of the process: that with all the variables included.
So the output is what you want. This works trivially when you have only
And if the number of independent variables is going to be unknown at
runtime or will change with different runs, don't hardcode it. Use
a macro to grab the number of variables in the list, and use that in
the START= option.
One last point: this trick will also let you get a host of other
regression diagnostics and criteria: AIC, BIC, SBC, Mallow's CP, the
GMSEP, JP, the MSE and RMSE, the PC, the SIGMA used for CP and BIC,
the SP, and/or the SSE, along with the regression coefficients, R**2,
the adjusted R**2, df error, p, and the number of regressors not
includibng the intercept. I've needed more than one of these in the
past, and had to reosrt to this trick on pre-V7 systems.
David Cassell, OAO firstname.lastname@example.org
Senior Computing Specialist