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

st: Calculating means to use in later regressions


From   "Joel Clovis" <[email protected]>
To   [email protected]
Subject   st: Calculating means to use in later regressions
Date   Mon, 9 Sep 2002 14:15:04 +0100

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/



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