Date: Wed, 28 Aug 1996 19:21:13 -0400
Reply-To: SFBAY0001 <firstname.lastname@example.org>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: SFBAY0001 <sfbay0001@AOL.COM>
Organization: America Online, Inc. (1-800-827-6364)
Subject: Re: Help: Saving residuals PROC REG
the solution here is to use DROP data set option in the OUTPUT statement.
When the OUTPUT statement is used in PROC REG, the default is to output to
the new data set all the variables and observations in the data set upon
which the procedure operates plus whatever variables are being created in
the OUTPUT statement.
In many situations, especially where there are many observations and many
variables in the "source" data set, use of default capabilities in this
area leads to larger data sets than that which are necessary to accomplish
Here is what I suggest.
a) Use the KEEP data set option in the PROC REG statement to only pass to
PROC REG those variables which will be used in the MODEL, BY or other
statements. This can result in reduced processing time, as well as reduce
the size of any output data set made by using the OUTPUT statement.
b) Use the KEEP data set option again in the data set being created in
the OUTPUT statement to limit output in the new data set to those
variables which you want in the data set.
Here is an example;
PROC REG DATA=Andrew.DataSet1(Keep = ID XVAR YVAR);
MODEL YVAR = XVAR;
OUTPUT OUT=Andrew.DataSet2(Keep = RESID ID) RESIDUAL=RESID;
In my example, I "kept" variable ID because I may need to know the value
of the variable ID when I look at the contents of Andrew.DataSet2. Some
readers of this post may know that the keyword RESIDUAL can be abbreviated
to R if you want to save a few keystrokes.
Andrew H. Karp
Sierra Information Services: Solutions Using the SAS System
A SAS Institute Quality Partner in the United States of America
1489 Webster Street #1308
San Francisco, CA 94115
SFBAY0001 @ AOL.COM