08-17-2012 10:49 PM
I am using the standard OLS code and wish to have a look at the significance of the independent (income) on the dependent (firmvalue) on a yearly basis.
Currently I am subsetting my sample by year and running the regression. This is a long process as I have 60+ years...So I would like to ask whether it is possible to create a code to automatically do this for me?
So that the output would have the year, the coefficient and significance of income? Basically firm value is my dependent and I have one independent variable income.
My data is attached below. If anyone knows how to do this pls help
08-19-2012 09:30 AM
Then you would have better demontrated your problem by giving us a sample of just a few years, but each year with several companies. Remember, your question was about the significance of predictors on a yearly basis - which I understand to mean you want to estimate regressions for each year..
But given what I do understand you could do this:
proc sort data=have out=need;
proc reg data=need;
model y=x1 x2;
Using the "BY" statement in the regression proc tells it that the input data is coming in already grouped by year, and to run the PROC REG for each year independently. The only pre-requisite is to sort your dataset by year prior to the proc reg. This should avoid the need to subsample your data by year.