|Date: ||Wed, 17 Nov 2004 18:13:26 -0800|
|Reply-To: ||"Nordlund, Dan" <NordlDJ@DSHS.WA.GOV>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||"Nordlund, Dan" <NordlDJ@DSHS.WA.GOV>|
|Subject: ||Re: using procs within do loops|
From: David L. Cassell [mailto:cassell.david@EPAMAIL.EPA.GOV]
Sent: Wednesday, November 17, 2004 2:11 PM
Subject: Re: using procs within do loops
seema <firstname.lastname@example.org> wrote:
> I want to regress y on x and store the predicted y values in a file. I
> then want to regress these predicted values on x and I want to keep
> doing this till the beta values dont change anymore. I thought of
> writing a DO-UNTIL loop to do this but dont seem to be able to put
> proc within do loops. Any help is much appreciated.
First of all, do-loops are a part of the DATA step. You cannot
perform procs within a data step. That isn't how SAS works.
Second, to run a proc multiple times, you should instead be thinking
of using the SAS macro language and %DO loops.. which are not at
all the same as data step do-loops.
Third, why on earth do you want to do this sort of iterative
approach? What sort of properties do you expect the resultant
to have? Do you have any statistical research which validates this
approach? Aren't you worried about the cost of forcing your regressions
to match up against outliers and influence points this way? This could
in theory produce a really bad fit, if the data look a certain way.
If all you want is iterative fitting, why are you using
SAS/IML, or one of the SAS procs which permit you to perform
iterative fitting or other alternatives to simple linear regression?
David Cassell, CSC
Senior computing specialist
David has made good points as usual. I would just add that unless I have
misunderstood what the original requester was planning to do (and that is
quite possible), regressing the predicted values against the original
variables is not going to change anything. The betas should remain the
same, residual variation and std. errors of the betas will be 0.0, all
within machine precision. You will perfectly fit the stored predicted
At least that is how I see it late in the day,
Daniel J. Nordlund
Research and Data Analysis
Washington State Department of Social and Health Services
Olympia, WA 98504-5204