[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: taking averages of panel data
(1) you can create average values within a period of time:
bys country: egen average_inf = mean(inflation) if inrange(year,1995,1999)
(2) transform your variables to means:
collapse variable_list by year
Finally you -merge- them using country as your id.
R.E. De Hoyos
Department of Applied Economics
University of Cambridge
Cambridge, CB3 9DE, UK
Tel: +44 1223 335269
----- Original Message -----
Sent: Friday, February 27, 2004 9:01 PM
Subject: st: taking averages of panel data
> I have two questions.
> (1) I have a panel data covering 1994-2001, that has both firm-level and
> country-level data from multiple countries. I want to run cross-sectional
> regressions using averages across certain years. Can I just take averages
> of certain years for some variables and regress them on averages of
> variable? Can I regress them on observations of another variable from only
> a particular year?
> Example: regress per capita income in 1999 on average inflation from
> 1995-1999 and on average bank margin from 1995-1999 OR
> regress average per capita income from 1995-1999 on avg.
> inflation 1995-1999 and on avg. bank margin 1995-1999
> Can I do this in Stata, or do I have to take averages in some other
> and then convert it into a Stata dataset? What would be the easiest way of
> doing this?
> (2) I have two datasets: one is the panel above. The other has
> cross-country data from 1999 only. What I want to do is run
> cross-sectional regressions using data from both datasets. I want to take
> the averages of some variables over certain years (e.g. 1995-1999) from
> panel data and regress them on the 1999 data from the other dataset. Do I
> need to merge the datasets? How do I merge a panel with a cross-sectional
> I am new to the list, and I never did panel data analysis in Stata, so I
> apologize in advance if the answer to this was easy to find elsewhere. I
> would appreciate your help.
> Mehmet Genc
> * 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: