Date: Mon, 19 Apr 2004 16:13:59 -0700
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV>
Subject: Re: Help with Running Several Regressions in a Loop
Content-type: text/plain; charset=US-ASCII
Tamer Abdelgawad wrote:
> I have a data set with (financial) daily data from 1987 to 2003 (about
> 4300 observations). The set has the dependent variables Y1 ... Yn,
> (n=20), and a single independent variable X. For each of the 20
> dependent variables, I'd like to run several regressions on X over
> different time intervals. So for Y1, I'd like to regress Y1 on X for
> the years 1987-1989, 1988-1990, 1989-1991, ..., 2000-2003.
> Needless to say, I don't want to run each of these regressions one at
> a time. I'd like to be able to enter the name of the dependent
> variable at the top of the program, and have a loop run the
> regressions for each of the time periods.
This can certainly be done using BY variables, as Roger wisely
But I think I ought to toss a monkey wrench in at this juncture. It is
at all clear ot me that oyu should be using PROC REG at all. You have
series data, and you are completely ignoring the time-series structure.
would recommend looking at PROC AUTOREG instead. Or taking a gander at
Autobox software, which is very capable (and not sold by SAS).
David Cassell, CSC
Senior computing specialist