BookmarkSubscribeRSS Feed
Thomas_mp
Obsidian | Level 7

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,

3 REPLIES 3
Reeza
Super User

Can you please clean up how your code is formatted?

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

Thomas_mp
Obsidian | Level 7

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 !!

PGStats
Opal | Level 21

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2339 views
  • 1 like
  • 3 in conversation