Dear all,

I have the following data format where type is the type of the car (categorical). At each year, I have different number of car types.

input float ln_price long type long year
2.3 4 1998
1.3 3 1998
0.3 2 1998
1.2 4 1999
0.8 5 1999
3.6 2 1999
4.9 3 1999
2.3 1 2000
6.5 5 2000
4.2 2 2000
7.2 3 2000
end

What I want to do is that I want to run a regression, say, for each year, and store the coefficients of the categorical variable type. Because the number of coefficients changes year by year, I cannot combine two different matrices as suggested here:

https://stackoverflow.com/questions/...-file-when-the

or using statsby.

With the following command, I can store each regression coefficients as matrix:

forval i=1998/2000 {
reg ln_price i.type if year ==`i'
matrix betas_`i'=nullmat(beta) \ e(b)
}

However, I could not find a way to combine these new matrices since they have different number of independent variables.

Is it possible to store and combine regression coefficients that have different number of output variables?

Thanks for your time in advance.

Regards,