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

st: RE: Calculating means to use in later regressions


From   Lee Sieswerda <Lee.Sieswerda@tbdhu.com>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Calculating means to use in later regressions
Date   Mon, 9 Sep 2002 09:56:37 -0400

One of your variables is probably a string. Use -desc- to find out which
one, convert to a numeric format, and try again.
Lee Sieswerda

> -----Original Message-----
> From:	Joel Clovis [SMTP:Msrafjc2@fs1.ec.man.ac.uk]
> Sent:	Monday, September 09, 2002 9:15 AM
> To:	statalist@hsphsun2.harvard.edu
> Subject:	st: Calculating means to use in later regressions
> 
> Hello Stata users,
> 
> I have a variable called Country (list of county names) and another called
> 
> period (1 to 4 representing the decades 1960s through 1990s); and yet 
> another called RealGDP (annual realGDP per capita by country).   How can 
> I generate a the mean of each period for each country?  I would ideally
> like 
> to end up with a new variable which can be used to run cross-country 
> regression on the decade aveages.
> 
> 
> . collapse (mean)  RealGDP,  by(Country period)
> type mismatch
> r(109);
> 
> is clearly not working, nor is:
> 
> . by period, sort: gen AveRealGDP=sum(RealGDP)/sum(RealGDP~=.)
> type mismatch
> r(109);
> 
> . for Country: egen RealGDPbar = mean(RealGDP), by period
> "Country" invalid list type
> r(198);
> 
> So I'm stuck.  Can anyone help?
> 
> Best regards,
> 
> Joel Clovis
> Joel Clovis
> 
> *
> *   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/
*
*   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