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" <>
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

is clearly not working, nor is:

. by period, sort: gen AveRealGDP=sum(RealGDP)/sum(RealGDP~=.)
type mismatch

. for Country: egen RealGDPbar = mean(RealGDP), by period
"Country" invalid list type

So I'm stuck.  Can anyone help?

Best regards,

Joel Clovis
Joel Clovis

*   For searches and help try:

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