Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Urgent: Saving Coefficient


From   "Kakatua Kutta" <[email protected]>
To   [email protected]
Subject   st: Urgent: Saving Coefficient
Date   Wed, 24 Mar 2004 18:27:55 -0500

Country Code	Year	GDP
BAN	        1960	65
BAN	        1965	75
BAN	        1970	85		
CAN	        1960	25
CAN	        1965	35
CAN	        1970	45

Dear Stata Users,

Suppose I have the above data set. 
1.I want to regress GDP on year (reg GDP Year) for each country
2.Then I want to create a variable named "coeff" which saves the coefficent of Year variable from the each country regression above. 
gen coeff=_b[year]
_________________________________

I have used the following method:
*************************************
use data
sort countrycode year
encode countrycode,gen(id)
tsset id year
forv id=1/2 {
reg gdp year 
gen coeff=_b[year]
}

It is not working. Is there any way to make it work or you guys have better solution?
I would highly appreciate any help.

Thanks

Kakatua

 
-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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