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

Re: st: collapse panel data for each year

From   Ada Ma <>
Subject   Re: st: collapse panel data for each year
Date   Sat, 29 May 2004 17:23:19 +0100

it might worth you the time to check out the command -egen-?

say you trying to calculate the profit mean of each country:

bys country year: egen meanprofit=mean(profit)

Now you can have the mean / sum / sd / whatever by country in your original data set.

sarah smith wrote:

Dear Stata users:

I have panel data for several industries in 40 countries for 20 years. For each year, I am trying to collapse the data by country. I tried to use foreach and forvalues commands, but could not work it out. I would appreciate if you can help me.


*   For searches and help try:

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