[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: betacoef for new variable?

From   Fabian Nagel <>
Subject   st: betacoef for new variable?
Date   Thu, 20 Mar 2008 22:25:41 +0100

Dear Stata-community,

I want to generate a new variable containing the current value of the beta-coefficient for each country, each year. The dataset includes 30 countries for the period from 1980-2003.

My last thought was:

forvalues i=1/30 {
reg conver lag_log_ssegdp if country==`i', noconstant
generate beta=r(beta) if country==`i'

The problems I have now are:

I want the beta-coefficient to be calculated for each year AND each country and not only for each country, but right now I have no idea how I can achieve this.

When the loop generates beta=r(beta) I receive the r(109), type mismatch. Is there any possibility to save the beta-coefficients (for each year and each country) as a new variable?

Thanks for any suggestion in advance,

* For searches and help try:

© Copyright 1996–2019 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index