turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Rolling-window regressions

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 09:02 PM

Hello, The question may be confusing. Allow me to explain. I am running a regression Proc reg data= all_compus2 outest=est noprint ; ; model2 :model log_ME = log_BE ln_income_positve dummy_NI_negative leverage /noprint; ; by year group ; run;; I have about 2,000 observations per year (this number changes, depending on the year); I have 50 years of data. So I have about 100,000 = 2,000x50 observations, divided- each year in 48 groups. I run the regression and keep the parameter estimates and the intercept for each regression. The tricky part is that for each year "T", I have to use observations for the prior 10 years (from "T-10" to "T-1"). For instance, for the year 2000, I have to run a regression with observations from 1990-1999; then for year 2001, another regression with observations in years 1991-2000; for 2002 with observations 1992-2001…etc. So I will run 40 of identical regressions (I will miss 10 years of data), one per year, using 10 years of data starting the prior year. I have to do a lop, but I do not know how. Any body has an idea how to do this in a simple way? Thank you for your help,

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 10:57 PM

Can you please clean up how your code is formatted?

Also, do you have a license for SAS/ETS?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 11:29 PM

Hello Reeza, The data consists of apprx 100,000 observations, in rows, each observation is a firm; the variables are firm- accounting characteristics observed annually; the groups identify industries. I have 50 years of data. I need to run about 40 regressions, one regression for each year and group, using observations of the prior 10 years; I keep the estimated coefficients and intercept for each regression to use in other analysis. The proc reg for each regression is Proc reg data= all_compus2 outest=est noprint ; model2 :model log_ME = log_BE ln_income_positve dummy_NI_negative leverage /noprint; ; by year group ; run;; I am not sure about the SAS/ETS. I will ask tomorrow to technical support Thank you !!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

07-01-2015 11:48 PM

I would try to replicate the data to create all the required 10-year periods. Something like this:

**%let lastYear=2014;**

**data expanded;**

**set all_compus2;**

**do year10 = year to year+9;**

** if year10 <= &lastYear then output;**

** end;**

**run;**

**proc sort data=expanded; by year10 group year; run;**

**Proc reg data= expanded outest=est noprint;**

**model2 :model log_ME = log_BE ln_income_positve dummy_NI_negative leverage /noprint;**

**by year10 group ; **

**run;**

PG

PG