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

Re: st: Urgent: Saving Coefficient


From   "Kakatua Kutta" <ambush@earthling.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Urgent: Saving Coefficient
Date   Wed, 24 Mar 2004 20:56:09 -0500

Thank a lot Dev. But I ran into a rather weird problem while applying it to real data. It seems that the loop abruptly stops whenever their are  missing values for variables used in the regression. In my case, the data starts with e.g. BAN and gdp for BAN is all missing like this:

Country Code	Year	GDP
 BAN	        1960	.
 BAN	        1965	.
 BAN	        1970	.


The loop does not produce any result and gives "no observation" and just stops.

Any suggestions?

Kakatua

----- Original Message -----
From: "Dev Vencappa" <lexdvv@nottingham.ac.uk>
Date: Wed, 24 Mar 2004 23:35:44 +0000
To: <statalist@hsphsun2.harvard.edu>
Subject: Re: st: Urgent: Saving Coefficient

> >>> ambush@earthling.net 03/24/04 11:27pm >>>
> Country Code	Year	GDP
> BAN	        1960	65
> BAN	        1965	75
> BAN	        1970	85		
> CAN	        1960	25
> CAN	        1965	35
> CAN	        1970	45
> 
> >>>>>
> 
> 
> In line with what you have written, try this:
> 
> use data
> sort countrycode year
> encode countrycode,gen(id)
> tsset id year
> gen coeff=.
> forv id=1/2 {
> reg gdp year 
> replace coeff=_b[year] if id==`id'
> }
> 
> 
> This will give you a column of all values for coeff for each country code. You can then drop repeat values using the duplicates command. 
> 
> Dev
> 
> 
> 
> *
> *   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/

-- 
___________________________________________________________
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index